You must perform a HEAD request. This will tell the server that you're only interested in the HTTP headers.
stream_context_set_default(
array(
'http' => array(
'method' => 'HEAD'
)
)
);
$headers = get_headers('http://example.com');
This will return an array of headers. You must find the content-length item which has the file size (number of bytes).