Page 1 of 1

Copying Remote Images

Posted: Fri Nov 10, 2006 3:25 am
by vivekjain
Hi,
I am trying to copy remote images from one server to another, but am getting this error:

Warning: copy(http://domainanme/image_name.jpg) [function.copy]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in


But if I try this from my local machine, it works fine, but from one remote server to another, it doesnt seem to work.

Any help would be much appreciated.

Thanks

Posted: Fri Nov 10, 2006 3:20 pm
by feyd
file_get_contents() + file_put_contents() (or a similar set of functionality if you aren't running php 5)

Remote Image Copying

Posted: Fri Nov 10, 2006 10:57 pm
by vivekjain
Hi,
Thanks for your reply. I tried that, but getting the same problem.
This is the image that I am trying to copy:

http://www.picklesandloop.com/images/pr ... e/_MG_0060 400x550.jpg

Of course, for images on other remote servers, we are able to copy images, but not for the one above.

Thanks

Posted: Fri Nov 10, 2006 11:04 pm
by alex.barylski
WHOA 8O

Nice site... 8) :twisted:

I'm surprised no one has questioned your motives...using those images on your own site without permission...is a bad thing called image burning...or hotlinking, etc...

Naughty naughty...like those girls on the homepage :P

They might have some kind of prevention mechanism built into the site to prevent such a thing...your likely SOL buddy ;)

Posted: Fri Nov 10, 2006 11:09 pm
by feyd
It's quite possible their server has active denials based on all sorts of information. You may need to use cURL.

Posted: Sat Nov 11, 2006 1:38 am
by AKA Panama Jack

Code: Select all

$ch = curl_init ($url . $filename);
$fp = fopen ($directory . $filename, "w");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
$url = the url to copy from IE: http://www.mine.com/images/
$filename = the name of the image file to copy
$directory = the directory path to save the image IE: /home/mysite/newimages/

That should do it.