Getting very confused over an image file - can you help?

1 replies
I'm trying to download an image from a web page to save remotely.

The url of the image is http://vintage-british-diecasts.lefo...7/P3270552.jpg

(I'm trying to help a friend archive his forum, so am not breaching copyright).

Problem is that when I use either PHP to download the image by using file_get_contents or by using CURL, the file that I get is not the .jpg file, but the HTML source code of the page it is sitting on.

I've tried several different methods in PHP and CURL but the result is always the same. The file contents I end up with is:

Code:
<html><head></head><body><img src="http://vintage-british-diecasts.lefora.com/composition/attachment/6e0d8d1af650b33daea499e0757725d5/507827/P3270552.jpg"></body></html>
What am I doing wrong?

Martin
#confused #file #image
  • Profile picture of the author Valdor Kiebach
    Not sure what you are trying to do.

    Do you have a php script on your own localhost to download all files from your friends site to your localhost.
    Do you have a php script hosted somewhere that is downloading your friends site files to the host the script is on.
    Do you have a php script hosted somewhere that is downloading your friends site files to your computer at home.

    Why not FTP the whole site or 'right click and save as'
    {{ DiscussionBoard.errors[8203691].message }}

Trending Topics