Grabbing image with cURL php -


trying save image server using curl. image appears download. shows correct bytes when link image not work. dl see , nope blank image.

here code... whats issue it?

$ch = curl_init("'. $image .'"); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer,1); $rawdata=curl_exec ($ch); curl_close ($ch);  $fp = fopen("$rename.jpg",'w'); fwrite($fp, $rawdata);  fclose($fp); 

i test script work fine me, remove useless double quote , dot $image.

<? $image ="http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=5"; $rename="123";  $ch = curl_init($image); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer,1); $rawdata=curl_exec ($ch); curl_close ($ch);  $fp = fopen("$rename.jpg",'w'); fwrite($fp, $rawdata);  fclose($fp); ?> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -