copy() function problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pushkidman
Forum Newbie
Posts: 1
Joined: Tue Jun 29, 2010 6:18 pm

copy() function problem

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: copy() function problem

Post 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).
Post Reply