Last active
December 25, 2015 13:59
-
-
Save dmoralesm/6987776 to your computer and use it in GitHub Desktop.
Get remote file size using php.
This file contains 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
<?php | |
function getRemoteFileSize($url) { | |
$info = get_headers($url,1); | |
if (is_array($info['Content-Length'])) { | |
$info = end($info['Content-Length']); | |
} | |
else { | |
$info = $info['Content-Length']; | |
} | |
return $info; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment