Unable save image locally with PHP Curl -



Unable save image locally with PHP Curl -

i trying utilize php curl save image computer, isnt working, help appreciated. image save: https://s.yimg.com/aw/api/res/1.2/mrhsvbj10l4trtng5j7eba--/yxbwawq9exr3yxvjdglvbnnlcnzpy2u7ad0xnta7ct04nttzcj0xlji7c3m9ms4yo3c9mjaw/http://nevec-img.zenfs.com/prod/tw_ec05-7/258e866a-b39a-471d-8e6c-62801cbccd9d.jpg

my curl function:

function grab_image($url,$saveto){ $ch = curl_init ($url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer,1); curl_setopt($ch, curlopt_followlocation, 0); $rawdata=curl_exec($ch); curl_close ($ch); if(file_exists($saveto)){ ($saveto); } $fp = fopen($saveto,'x'); fwrite($fp, $rawdata); fclose($fp); }

i pretty sure permission place save 777 because can save image other website without problem.

thanks again

it's https request, please add together curl_setopt($ch, curlopt_ssl_verifypeer, 0);

if want know what's going on, add together $errmsg = curl_error($ch); before curl_close, , echo $errmsg;.

php curl

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -