On Feb 2, 4:05 pm, artlove...@yahoo.com wrote:
Hi everyone !
I am just wondering if capturing an image remotely with php is
doable ?
I am working on a project for my department where I need to write php
code to capture an remote image and save it to a local folder/web site
directory given an image's URL.
Have anyone done anything like this ? If you have, do you mind share
your ideas/sample code ?
Thank you in advance,
Josh
If by "capturing an image remotely" you mean download and image from
another website and store it locally, you have a couple of options.
Both of these can be very simple depending on the configuration of
your php installation.
1. If allow_url_fopen is enabled on your machine, you can simply use
fopen to download the image, and use the resulting file handle to copy
the data to wherever you wish.
http://www.php.net/fopen : see the comment made on '22-Jan-2007
02:34', which, If i understood you correctly, does exactly what you
want.
2. Slightly more complex, but if your php installation supports curl
you can simply use curl to fetch the remote data.
http://www.php.net/curl
Carl.