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
Copying Remote Images
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
file_get_contents() + file_put_contents() (or a similar set of functionality if you aren't running php 5)
Remote Image Copying
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
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
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
WHOA
Nice site...
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
They might have some kind of prevention mechanism built into the site to prevent such a thing...your likely SOL buddy
Nice site...
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
They might have some kind of prevention mechanism built into the site to prevent such a thing...your likely SOL buddy
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
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);
$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.