Curl binary code from wiki

software development


hola everyone, I was using the wiki snippet to try and get flickr thumbnails. It was working a few months ago…now suddenly its returning a different content length therby breaking the image…I’ve uploaded a local jpg for
testing purposes …

the basic code is here…

$_url = “”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$data = curl_exec($ch);
$length = strlen($data);
header(‘Accept-Ranges: bytes’);
header('Content-Length: '.$length);
header(‘Content-Type: image/jpeg’);

fiddler then shows an error of
"Content-Length mismatch: Response Header claimed
1796 bytes, but server sent 1799 bytes."

this happens if I try local files and remote files.
or even if i copy and paste the wiki binary transfer code

I’ve attempted the php manual and noticed no-one else
seems to be coming accross this…

any help would be greatly appreciated …