here, this is from my functions class
private function curl_get_image($ch,$url,$ref)
{
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_REFERER,$ref);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_BINARYTRANSFER,1);
curl_setopt($ch,CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch,CURLOPT_HTTPHEADER, array("Pragma:","Accept: image/png,image/*;q=0.8,*/*;q=0.5","Accept-Language: en-us,en:,q=0.5","Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7","Keep-Alive: 300"));
$rawImage = curl_exec($ch);
/*
$fout = fopen("/an/absolute/path/system/captchas/test".rand(1,40).".png",'w');
fwrite($fout,$rawImage);
fclose($fout);
*/
return($rawImage);
}
you can proceed to fpc the bulk of what it returns. keep in mind you need a curl handle already init'd and you have to pass it to this function as well.