PHP识别任何类型的验证码图片
<?php/** 说明:此类函数是基于优优云图片识别平台的API接口,调用类中的函数可以进行图片识别 类中的公有函数: setSoftInfo($softID,$softKey); //设置软件ID和KEY userLogin($userName,$passWord); //用户登录,登录成功返回用户的ID getPoint($userName,$passWord); //获取用户剩余题分 upload($imagePath,$codeType); //根据图片路径上传,返回验证码在服务器的ID,$codeType取值查看:http://www.uuwise.com/price.html getResult($codeID); //根据验证码ID获取识别结果 autoRecognition($imagePath,$codeType); //将upload和getResult放到一个函数来执行,返回验证码识别结果 reportError($codeID); //识别结果不正确报错误 regUser($userName,$userPassword) //注册新用户,注册成功返回新用户的ID pay($userName,$Card); //充值题分,充值成功返回用户当前题分 类中的公有变量: $macAddress='00e021ac7d'; //客户机的mac地址,服务器暂时没有用,后期准备用于绑定mac地址 赋值方法: $obj->macAddress='00e021ac7d'; $timeOut='60000'; //超时时间,建议不要改动此值 赋值方法: $obj->timeOut=60000; 函数调用方法: 需要先new一个对象 $obj=new uuApi; $obj->setSoftInfo('2097','b7ee76f547e34516bc30f6eb6c67c7db'); //如何获取这两个值?请查看这个页面:http://dll.uuwise.com/index.php?n=ApiDoc.GetSoftIDandKEY $obj->userLogin('userName','userPassword'); $result=autoRecognition($imagePath,$codeType); */class uuApi{ private $softID; private $softKEY; private $userName; private $userPassword; private $uid; private $userKey; private $softContentKEY; private $uuUrl; private $uhash; private $uuVersion='1.1.0.1'; private $userAgent; private $gkey; public $macAddress='00e021ac7d'; //客户机的mac地址,服务器暂时没有用,后期准备用于绑定mac地址 赋值方法: $obj->macAddress='00e021ac7d'; public $timeOut=60000; //超时时间,建议不要改动此值 赋值方法: $obj->timeOut=60000; public function setSoftInfo($id,$key) { if($id&&$key){ $this->softID=$id; $this->softKEY=$key; $this->uhash=md5($id.strtoupper($key)); return 'YES'; } return 'NO'; } private function getServerUrl($Server) { $url = "http://common.taskok.com:9000/Service/ServerConfig.aspx"; $result=$this->uuGetUrl($url,array(),$postData=false); preg_match_all("/\,(.*?)\:101\,(.*?)\:102\,(.*?)\:103/", $result, $match_index); $arr=array_filter($match_index); if(empty($arr)){return '-1001';} switch($Server) { case 'service': return 'http://'.$match_index[1][0]; break; case 'upload': return 'http://'.$match_index[2][0]; break; case 'code': return 'http://'.$match_index[3][0]; break; default: return 'parameter error'; } curl_close($this->uuUrl); } public function userLogin($userName,$passWord) { if(!($this->softID&&$this->softKEY)) { return 'sorry,SoftID or softKey is not set! Please use the setSoftInfo(id,key) function to set!'; } if(!($userName&&$passWord)){ return 'userName or passWord is empty!';} $this->userName=$userName; $this->userPassword=$passWord; $this->userAgent=md5(strtoupper($this->softKEY).strtoupper($this->userName)).$this->macAddress; $url = $this->getServerUrl('service').'/Upload/Login.aspx?U='.$this->userName.'&P='.md5($this->userPassword).'&R='.mktime(); $result=$this->uuGetUrl($url); if($result>0) { $this->userKey=$result; $this->uid=explode("_",$this->userKey); $this->uid=$this->uid[0]; $this->softContentKEY=md5(strtolower($this->userKey.$this->softID.$this->softKEY)); $this->gkey=md5(strtoupper($this->softKEY.$this->userName)).$this->macAddress; return $this->uid; } return $result; } public function getPoint($userName,$passWord) { if(!($userName&&$passWord)){ return 'userName or passWord is empty!';} $url = $this->getServerUrl('service').'/Upload/GetScore.aspx?U='.$userName.'&P='.md5($passWord).'&R='.mktime(); $result=$this->uuGetUrl($url); return $result; } public function upload($imagePath,$codeType,$auth=false) { if(!file_exists($imagePath)){return '-1003';} if(!is_numeric($codeType)){return '-3004';} $data=array( 'img'=>'@'.$imagePath, 'key'=>$this->userKey, 'sid'=>$this->softID, 'skey'=>$this->softContentKEY, 'TimeOut'=>$this->timeOut, 'Type'=>$codeType ); $ver=array( 'Version'=>'100', ); if($auth){$data=$data+$ver;} $url = $this->getServerUrl('upload').'/Upload/Processing.aspx?R='.mktime(); return $this->uuGetUrl($url,$data); } public function getResult($codeID) { if(!is_numeric($codeID)){return '-1009|The codeID is not number';} $url = $this->getServerUrl('code').'/Upload/GetResult.aspx?KEY='.$this->userKey.'&ID='.$codeID.'&Random='.mktime(); $result='-3'; $timer=0; while($result=='-3'&&($timer<$this->timeOut)) { $result=$this->uuGetUrl($url,false,false); usleep(100000); } curl_close($this->uuUrl); if($result=='-3') { return '-1002'; } return $result; } public function autoRecognition($imagePath,$codeType) { $result=$this->upload($imagePath,$codeType,$auth=true); if($result>0){ $arrayResult=explode("|",$result); if(!empty($arrayResult[1])){return $arrayResult[1];} return $this->getResult($result); } return $result; } private function uuGetUrl($url,$postData=false,$closeUrl=true) { $uid=isset($this->uid)?($this->uid):'100'; $default=array( 'Accept: text/html, application/xhtml+xml, */*', 'Accept-Language: zh-CN', 'Connection: Keep-Alive', 'Cache-Control: no-cache', 'SID:'.$this->softID, 'HASH:'.$this->uhash, 'UUVersion:'.$this->uuVersion, 'UID:'.$uid, 'User-Agent:'.$this->userAgent, 'KEY:'.$this->gkey, ); $this->uuUrl = curl_init(); curl_setopt($this->uuUrl, CURLOPT_HTTPHEADER, ($default)); curl_setopt($this->uuUrl, CURLOPT_HEADER, false); curl_setopt($this->uuUrl, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->uuUrl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($this->uuUrl, CURLOPT_VERBOSE, false); curl_setopt($this->uuUrl, CURLOPT_TIMEOUT, $this->timeOut); curl_setopt($this->uuUrl, CURLOPT_AUTOREFERER, true); curl_setopt($this->uuUrl, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->uuUrl, CURLOPT_HTTPGET, true); curl_setopt($this->uuUrl, CURLOPT_URL,$url); if($postData) { curl_setopt($this->uuUrl, CURLOPT_POST, true); curl_setopt($this->uuUrl, CURLOPT_POSTFIELDS, $postData); } $info=curl_exec($this->uuUrl); if($closeUrl){ curl_close($this->uuUrl); } return trim($info); } public function reportError($codeID) { if(!is_numeric($codeID)){return '-1009|The codeID is not number';} if($this->softContentKEY&&$this->userKey) { $url = $this->getServerUrl('code').'/Upload/ReportError.aspx?key='.$this->userKey.'&ID='.$codeID.'&sid='.$this->softID.'&skey='.$this->softContentKEY.'&R='.mktime(); $result=$this->uuGetUrl($url); if($result=='OK') { return 'OK'; } return $result; } return '-1'; } public function regUser($userName,$userPassword) { if($this->softID&&$this->softKEY) { if($userName&&$userPassword) { $data=array( 'U'=>$userName, 'P'=>$userPassword, 'sid'=>$this->softID, 'UKEY'=>md5(strtoupper($userName).$userPassword.$this->softID.strtolower($this->softKEY)), ); $url=$this->getServerUrl('service').'/Service/Reg.aspx'; return $this->uuGetUrl($url,$data); } return 'userName or userPassword is empty!'; } return '-1'; } public function pay($userName,$Card) { if($this->softID&&$this->softKEY) { if($userName&&$Card) { $data=array( 'U'=>$userName, 'card'=>$Card, 'sid'=>$this->softID, 'pkey'=>md5(strtoupper($userName).$this->softID.$this->softKEY.strtoupper($Card)), ); $url=$this->getServerUrl('service').'/Service/Pay.aspx'; return $this->uuGetUrl($url,$data); } return 'userName or Card is empty!'; } return '-1'; }}?>
终于研究出来他们的API了,
现在识别基本是万能的,测试图片
回复讨论(解决方案)
广告贴?百度了一下这个公司,很明显是人工识别。
保留怀疑意见~~
请识别验证码图片:s+b=?
60秒时间,是不是太长了,而且这个在哪里可以用到呢?这个耗的资源更多
有一种职业,叫网络打字员
还是很有用处的
60秒时间,是不是太长了,而且这个在哪里可以用到呢?这个耗的资源更多
抢火车票,抢小米,各种啊

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Alipay PHP ...

JWT는 주로 신분증 인증 및 정보 교환을 위해 당사자간에 정보를 안전하게 전송하는 데 사용되는 JSON을 기반으로 한 개방형 표준입니다. 1. JWT는 헤더, 페이로드 및 서명의 세 부분으로 구성됩니다. 2. JWT의 작업 원칙에는 세 가지 단계가 포함됩니다. JWT 생성, JWT 확인 및 Parsing Payload. 3. PHP에서 인증에 JWT를 사용하면 JWT를 생성하고 확인할 수 있으며 사용자 역할 및 권한 정보가 고급 사용에 포함될 수 있습니다. 4. 일반적인 오류에는 서명 검증 실패, 토큰 만료 및 대형 페이로드가 포함됩니다. 디버깅 기술에는 디버깅 도구 및 로깅 사용이 포함됩니다. 5. 성능 최적화 및 모범 사례에는 적절한 시그니처 알고리즘 사용, 타당성 기간 설정 합리적,

기사는 PHP 5.3에 도입 된 PHP의 LSB (Late STATIC BING)에 대해 논의하여 정적 방법의 런타임 해상도가보다 유연한 상속을 요구할 수있게한다. LSB의 실제 응용 프로그램 및 잠재적 성능

기사는 입력 유효성 검사, 인증 및 정기 업데이트를 포함한 취약점을 방지하기 위해 프레임 워크의 필수 보안 기능을 논의합니다.

PHP 개발에서 PHP의 CURL 라이브러리를 사용하여 JSON 데이터를 보내면 종종 외부 API와 상호 작용해야합니다. 일반적인 방법 중 하나는 컬 라이브러리를 사용하여 게시물을 보내는 것입니다 ...

이 기사에서는 프레임 워크에 사용자 정의 기능 추가, 아키텍처 이해, 확장 지점 식별 및 통합 및 디버깅을위한 모범 사례에 중점을 둡니다.

PHP 개발에서 견고한 원칙의 적용에는 다음이 포함됩니다. 1. 단일 책임 원칙 (SRP) : 각 클래스는 하나의 기능 만 담당합니다. 2. Open and Close Principle (OCP) : 변경은 수정보다는 확장을 통해 달성됩니다. 3. Lisch의 대체 원칙 (LSP) : 서브 클래스는 프로그램 정확도에 영향을 미치지 않고 기본 클래스를 대체 할 수 있습니다. 4. 인터페이스 격리 원리 (ISP) : 의존성 및 사용되지 않은 방법을 피하기 위해 세밀한 인터페이스를 사용하십시오. 5. 의존성 반전 원리 (DIP) : 높고 낮은 수준의 모듈은 추상화에 의존하며 종속성 주입을 통해 구현됩니다.

세션 납치는 다음 단계를 통해 달성 할 수 있습니다. 1. 세션 ID를 얻으십시오. 2. 세션 ID 사용, 3. 세션을 활성 상태로 유지하십시오. PHP에서 세션 납치를 방지하는 방법에는 다음이 포함됩니다. 1. 세션 _regenerate_id () 함수를 사용하여 세션 ID를 재생산합니다. 2. 데이터베이스를 통해 세션 데이터를 저장하십시오.
