Return to Snippet

Revision: 6008
at April 21, 2008 12:16 by multani


Initial Code
function SaveCurlPage ($url, $save_file) {  
     $ch = curl_init($url);  
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_REFERER, $url);         // need to fake a referer
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);  
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);  
     curl_setopt($ch, CURLOPT_COOKIEJAR, "curl_cookie");  
     curl_setopt($ch, CURLOPT_COOKIEFILE, "curl_cookie");  
     $tmp = curl_exec ($ch);  
     if(curl_errno($ch) == 0) {  
         file_put_contents($save_file, $tmp);  
     }  
     curl_close ($ch);  
     
     return curl_errno($ch);  
 }

Initial URL
http://blog.roodo.com/rocksaying/archives/2102451.html

Initial Description

                                

Initial Title
PHP CURL IMG DOWNLOAD

Initial Tags
curl, php, download

Initial Language
PHP