Skip to content

Instantly share code, notes, and snippets.

@dmoralesm
Last active December 25, 2015 13:59
Show Gist options
  • Save dmoralesm/6987776 to your computer and use it in GitHub Desktop.
Save dmoralesm/6987776 to your computer and use it in GitHub Desktop.
Get remote file size using php.
<?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