2levelsabove Posted September 14, 2008 Share Posted September 14, 2008 For example, i have an image link source "httP://sitename.com/somefile.gif" how to get that copied onto my web server under public_html/images would i be using curl ? Link to comment https://forums.phpfreaks.com/topic/124242-how-to-copy-an-image-from-a-remote-img-url-onto-my-server/ Share on other sites More sharing options...
genericnumber1 Posted September 14, 2008 Share Posted September 14, 2008 why do you want to do this? it's doubtful anyone will help you here if it's for something malicious. Link to comment https://forums.phpfreaks.com/topic/124242-how-to-copy-an-image-from-a-remote-img-url-onto-my-server/#findComment-641567 Share on other sites More sharing options...
2levelsabove Posted September 15, 2008 Author Share Posted September 15, 2008 Umm I have no malicious intent. Just a simple question because I need to to migrate some content from existing site to another. Link to comment https://forums.phpfreaks.com/topic/124242-how-to-copy-an-image-from-a-remote-img-url-onto-my-server/#findComment-641683 Share on other sites More sharing options...
genericnumber1 Posted September 15, 2008 Share Posted September 15, 2008 simplest method is $file = 'somefile.gif'; $image = file_get_contents("http://sitename.com/$file"); file_put_contents("/my/path/to/public_html/images/$file", $image); Link to comment https://forums.phpfreaks.com/topic/124242-how-to-copy-an-image-from-a-remote-img-url-onto-my-server/#findComment-641684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.