Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


copy an image file from a PHP url

copy an image file from a PHP url

copy an image file from a PHP url

I am extracting data from an XML file (with full consent) and I use the file to identify and copy files. From other similar feeds I simply identify the URL of the image then use copy ($from,$to) but in this case I have isolated the image file to


which works great as an IMG SRC but prevents me doing a straightforward copy as I would normally. I need to get to the heart of the PHP to get the image to copy but I dont know where to start. Ahy suggestions welcome but keep it simple please

RE: copy an image file from a PHP url


You mean this not works for you ?


copy('http://media.pafilia.cn/api/property/img.php?development=10&property=1241&img=1.jpg&logo=&h=768&w=1024&type=24&recordType=2', '1.jpg'); 
Then I am afraid the problem is elsewhere in your system, as the above works fine to me.


RE: copy an image file from a PHP url

does it copy a nice picture of a building (which displays nicely as an IMG SRC) or a image not available graphic?

RE: copy an image file from a PHP url


Building ? Oh, indeed, there is one in the background. ( I was distracted by the pool... )


RE: copy an image file from a PHP url

Same for me. Executing Feherkes code 1:1 I get a 1.jpg in the same directory as the php script with 85KB length, showing that same picture, as if using the URI in the browser.

What could stop copy from working is no write permission in the destination folder. Also ensure you specify a file name, not only a path. File name only is possible, as said that copies to the script location and works, as I have write permission set here in localhost.

So the only thing you should be concerned about in your production environment make sure you specify a destination having a path you can write to and having a file name.

Is your $to variable qualifying for these conditions?
If it does, I can only assume pafilia.cn is limiting requests per IP.

Bye, Olaf.

RE: copy an image file from a PHP url

Must be the way I am sitting :) Thank you guys for your efforts - much appreciated as always.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close