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

curl-and-php

Re: Invalid Image

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Sat, 11 Jul 2009 15:02:53 -0400

Shan Shui's solution is much simpler and easier, but if you need to do it
with cURL for other reasons, then simply set
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
Otherwise, curl_exec will simply return true if the request was successful,
not the actual request text.
-Stephen

On Sat, Jul 11, 2009 at 12:39, Liu Shan Shui <me_at_lx.sg> wrote:

> 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
>
>

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