Following function can download an URL and write it into a specified file.
<?PHP function downloadurl($url, $wfile) { $file = fopen ($url, "rb"); if ($file) { $newf = fopen ($wfile, "wb"); if ($newf) { while(!feof($file)) {fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );} } } if ($file) { fclose($file); } if ($newf) { fclose($newf); } } download("http://www.endmemo.com/index.php","em.htm");?>