Page 1 of 1

copy() function problem

Posted: Tue Jul 06, 2010 3:38 pm
by pushkidman
Hello everyone!

I am using copy() function to take images from external websites and copy them onto my server.
It worked fine for almost all websites, however, I came across one website... All images that I try to read and copy eventually come to my server as corrupt. They are all of the same size (27 smth kbytes).
I tried replacing copy() with file_get_contents() and got exactly same result.
Website is not https, so I do not know, what might be the reason.
Have you ever come across this problem or have any idea, what might be the problem?

Re: copy() function problem

Posted: Tue Jul 06, 2010 5:10 pm
by John Cartwright
The server probably implements some kind of hotlinking protection. You can use cURL to more closely manipulate the request to look like a real users request (user agent, referer, etc).