PHP has a built-in function file_get_contents(), which reads the content of a file into a string.
<?php
//Get the file
$content = file_get_contents("http://example.com/image.jpg");
//Store in the filesystem. $fp = fopen("/location/to/save/image.jpg", "w"); fwrite($fp, $content); fclose($fp); ?> If you wish to store the file in a database, simply use the $content variable and don't save the file to disk.