/ Published in: PHP
URL: http://blog.roodo.com/rocksaying/archives/2102451.html
Expand |
Embed | Plain Text
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); }
You need to login to post a comment.
