Archives

Posts Tagged ‘curl’

function mbmDownloadWithCURL($fileURL=”,$saveFile=”){ $fp = fopen ($saveFile, ‘w+’);//This is the file where we save the information //$ch = curl_init(‘http://www.yadii.net/files/videos/1244703817-saraa.flv’);//Here is the file we are downloading $ch = curl_init($fileURL);//Here is the file we are downloading curl_setopt($ch, CURLOPT_TIMEOUT, 50); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_exec($ch); curl_close($ch); fclose($fp); } Usage: mbmDownloadWithCURL(‘http://www.domain.com/file.zip’,'/home/username/public_html/foldername/filesaved.zip’);

Aug 15th, 2009 | Filed under PHP