App\services\Utils::getRemoteFileSize PHP Method

getRemoteFileSize() public static method

public static getRemoteFileSize ( $url )
    public static function getRemoteFileSize($url)
    {
        $regex = '/^Content-Length: *+\\K\\d++$/im';
        if (!($fp = @fopen($url, 'rb'))) {
            return false;
        }
        if (isset($http_response_header) && preg_match($regex, implode("\n", $http_response_header), $matches)) {
            return (int) $matches[0];
        }
        return strlen(stream_get_contents($fp));
    }