You can, however, just request the HTTP headers and not the entire content:
<pre><?php
$ch = curl_init('http://phpbuilder.com/images/logo.gif');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = curl_exec($ch);
if($headers)
{
preg_match('#Content-Length: *(\d+)\b#i', $headers, $matches);
$size = (!empty($matches[1])) ? $matches[1] : false;
preg_match('#Content-Type: *(\S+)\b#i', $headers, $matches);
$type = (!empty($matches[1])) ? $matches[1] : false;
}
var_dump($size);
var_dump($type);
?></pre>