I am using Curl to download files from location
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
header("Content-Type: application/force-download");
header("Content-disposition: attachment; filename=zipfile.tar.gz");
echo $data;
}
$rt = get_data('http://slackbuilds.org/slackbuilds/13.37/multimedia/umplayer.tar.gz');
This does download files , but am not able to open it.Is it mandatory to mention proper Content-Type ? And am using this script for videos , so i tried with Content-Type : Video , but still its not proper.
Set CURLOPT_BINARYTRANSFER to TRUE and change the content type.