// get the host name and url path
$parsedUrl = parse_url($url);
+ if (@$parsedUrl['scheme'] == 'file')
+ return file_get_contents($parsedUrl['path']);
+
$host = $parsedUrl['host'];
if (isset($parsedUrl['path'])) {
function url_copy($from, $to, $timeout=10)
{
$f = fopen($to, 'wb');
- fwrite($f, url_get_contents($from, $timeout));
+ if (!$f || !fwrite($f, url_get_contents($from, $timeout)))
+ return false;
fclose($f);
+ return true;
}