Re: Best way to recieve image from url?
| From: | Micah Gersten | Date: | Mon, 20 Oct 2008 00:05:09 +0000 |
| Subject: | Re: Best way to recieve image from url? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282119@lists.php.net to get a copy of this message | ||
If you're using file_get_contents, why aren't you using file_put_contents?
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Nitsan Bin-Nun wrote:
> Hi,
> I have this function:
>
>
> function saveImageFromUrl($image_url, $image_save)
> {
> $contents = file_get_contents($image_url);
>
> $fp = fopen($image_save, 'w');
> fwrite($fp, $contents);
> fclose($fp);
> }
>
> As you can see it fetches the images contents and write them to new image on
> my local directory.
> Is this is the best way to do this? (I don't have curl)
> Does file_get_contents() uses buffer to get the contents of the image? (in
> case the server response is slow)
> There is a better way?
>
> Thanks in Advance,
> Nitsan
>
>