I used this code to get the image size in php and it worked fine for me.
$img = get_headers("http://ultoo.com/img_single.php", 1); $size = $img["Content-Length"]; echo $size;
But how to get this through CURL? I tried this but it does not work.
$url = 'http://ultoo.com/img_single.php'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, "Content-Length" ); //curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $filesize = $result["Content-Length"]; curl_close($ch); echo $filesize;
source share