homepage Welcome to WebmasterWorld Guest from 54.166.228.100
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Retrieving/dumping image from another site
TechMan




msg:4128823
 4:07 pm on May 7, 2010 (gmt 0)

Hi,

How can I retrieve/dump images from another site using PHP?
For e.g. if this is the URL

www.webmasterworld.com/image.jpg

Then how can I save this image on my server using PHP. Can this be done using Snoopy class?

Thanks

 

Matthew1980




msg:4129401
 7:16 pm on May 8, 2010 (gmt 0)

Hi there TechMan

I am by no means an expert on this, nor have I ever tried this method, but, copy(); or rename(); may be the way to go here, just thought I would offer those suggestions.

I am assuming at this point as these are pictures on your site(s) because I think lifting them like this is a bit dodgy.

May be worth having a read of [uk3.php.net ] and [uk3.php.net ] to see if you can use full paths too.

Cheers,
MRb

arvind gupta




msg:4129641
 7:09 am on May 9, 2010 (gmt 0)

Hello,

I don't think Snoopy would work as it can't fetch binary data as far as I remember. You can try using
file_get_contents() with the flags argument set to FILE_BINARY .

This might not work in case the remote server does some checking on user agent etc.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved