Example #1
0
    /**
     * Retrieve header data via curl.
     *
     * @return array
     */
    function curl_get_header()
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $this->get_file_url());
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        // make curl_exec() return the result
        curl_setopt($curl, CURLOPT_HEADER, true);
        // header only
        curl_setopt($curl, CURLOPT_NOBODY, true);
        // return no body; HTTP request method: HEAD
        curl_setopt($curl, CURLOPT_FAILONERROR, true);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        // follow redirects
        curl_setopt($curl, CURLOPT_MAXREDIRS, 5);
        // maximum number of redirects
        curl_exec($curl);
        $info = curl_getinfo($curl);
        curl_close($curl);
        return $info;
    }
}
MediaFile::property('id', 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
MediaFile::property('episode_id', 'INT');
MediaFile::property('episode_asset_id', 'INT');
MediaFile::property('size', 'INT');