cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: Invalid Image

From: Liu Shan Shui <me_at_lx.sg>
Date: Sun, 12 Jul 2009 00:39:11 +0800

Hi Uddin,

 

If you're not too concerned with performance, and are running on PHP 5 with
allow_url_fopen enabled, you may want to try this instead:

file_put_contents('filename.png', file_get_contents($url_of_image));

 

Make sure the necessary directory/file permissions are set correctly (CHMOD
777) beforehand.

 

With regards,

Liu Shan Shui

me_at_lx.sg

"Life would be much easier if I had the source code." - Anonymous

 

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Muhammad Moeen uddin
Sent: Saturday, July 11, 2009 11:59 PM
To: curl-and-php_at_cool.haxx.se
Subject: Invalid Image

 

... im downloadin image files...

 

$ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $val);
 $content = curl_exec ($ch);
 // CLOSE CURL
 curl_close ($ch);

 $fp = fopen(basename($val),'wb');
 fwrite($fp,$content);
 fclose($fp);

need help!!

 

Regards

 

moeen

 

 

 

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-11