Last active
July 22, 2016 07:36
-
-
Save nguyenbathanh/dc1085993842462af01ad02c7c632271 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadFile($url, $path) | |
{ | |
$newfname = $path; | |
$file = fopen ($url, 'rb'); | |
if ($file) { | |
$newf = fopen ($newfname, 'wb'); | |
if ($newf) { | |
while(!feof($file)) { | |
fwrite($newf, fread($file, 1024 * 8), 1024 * 8); | |
} | |
} | |
} | |
if ($file) { | |
fclose($file); | |
} | |
if ($newf) { | |
fclose($newf); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment