Saving an image from a PHP URL using curl and PHP
<p>I have tried to download an image from a PHP link. When I try the link in a browser it downloads the image. I enabled curl and I set “allow_url_fopen” to true. I’ve used the methods discussed here <a href="http://stackoverflow.com/questions/724391/saving-image-from-php-url-using-php">Saving image from PHP URL using PHP</a> but it didn’t work. I've  tried "file_get_contents" too, but it didn't work.
I made few changes, but still it doesn’t work. This is the code</p>

<pre><code>$URL_path='http://…/index.php?r=Img/displaySavedImage&amp;id=68';
$ch = curl_init ($URL_path);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$raw=curl_exec($ch);
curl_close ($ch);
$fp = fopen($path_tosave.'temp_ticket.jpg','wb');
fwrite($fp, $raw);
fclose($fp);
</code></pre>

<p>Do you have any idea to make it works? Please help. Thanks </p>
