anyone know a php that lets me grab a remote file to my web server?

SleepieGirl

Regular Member
Joined
Mar 7, 2009
Messages
439
Reaction score
294
i need a php script that just lets me put a url into it and retrieves the file...
 
simple:
Code:
<?php
$content = file_get_contents('http://www.example.com/image.png');
file_put_contents('image.png', $content);
?>

this code will download the image from the given url and will save it locally on the server as image.png
 
thanks.
hey how would i make this accept like this

Code:
http://www.mysite.com/mysite.php?http://www.imagesite.com/image.jpg
 
Code:
<?php
$image = $_REQUEST['image'] ;
$name = $_REQUEST['name'] ;
$content = file_get_contents("$image");
file_put_contents("./images/$name.jpg", $content);
?>
Code:
http://www.mysite.com/GetImage.php?name=ImageName&image=http://www.imagesite.com/image.jpg
 
You also might want to look at the PHP manual for the command "CURL". Supposedly if you set it up right it can retrieve images even if they are blocked on the other server by a htaccess redirect. Saves you from getting a bunch of those "don't steal my bandwidth" logos.
 
the script you want is rapidleech. it can download files from any third party file hostings to your server and upload them. Its free but the site is down now so you can google to have latest plugin.
Posted via Mobile Device
 
the script you want is rapidleech. it can download files from any third party file hostings to your server and upload them. Its free but the site is down now so you can google to have latest plugin.
Posted via Mobile Device

i have already pasted the script i wanted right up there...
thanks anyway.
 
Back
Top