Se agrega igual como lo andas haciendo:
<?php
function retrieve_remote_file_size($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_setopt($ch, CURLOPT_PATH_AS_IS, TRUE);
$data = curl_exec($ch);
$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($ch);
return $size;
}
echo retrieve_remote_file_size
("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"); ?>
Referencia:
https://www.php.net/manual/es/function.curl-setopt.phpImportante: CURLOPT_PATH_AS_IS true para no manejar secuencias de puntos. Añadida en cURL 7.42.0. Disponible desde PHP 7.0.7.