识别验证码API

补上暑假做的识别简单验证码,识别英文数字



function _http($url,$data='',$cookiefile='',$cookiejar=''){
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($cookiefile){
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
}
curl_setopt($ch, CURLOPT_REFERER, $url);
if($data){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect'));
}
if($cookiejar){
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 500);
$str=curl_exec($ch);
curl_close($ch);
return $str;
}



function verify_pic(){
$url="http://lab.ocrking.com/do.html";
$post = array (
'url'=>'http://www.xiaoxiang123.com/Verify/Verify.ashx?0.6332066934555769',
'service'=>'OcrKingForCaptcha',
'language'=>'eng',
'charset'=>'1',
);
echo _http($url,$post,'','');
}


post参数:
验证码地址:url
不会返回cookie的,所以得先下载到自己的服务器上,然后提供保存图片文件的url

识别类型:service:









识别语种:language





(系统可能对参数自动优化)

字 符 集:charset"













这里借用了 http://lab.ocrking.com/提供的服务,
结果呢,识别成功率特别低,失望。
得自己做一个能识别纯数字的程序。

你可能感兴趣的:(php)