Last active
April 9, 2018 12:14
-
-
Save filippotoso/1d1e4620f802473ebb8f342c671eaf42 to your computer and use it in GitHub Desktop.
PHP remote file size
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 | |
use GuzzleHttp\Client; | |
function remote_file_size($url) { | |
$client = new Client(); | |
$response = $client->head($url); | |
$headers = $response->getHeader('Content-Length'); | |
return end($headers); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment