PHP identifies any type of CAPTCHA image

Source: Internet
Author: User
 macaddress= ' 00e021ac7d '; $timeOut = ' 60000 ';//timeout, we recommend that you do not change this value assignment method: $obj->timeout=60000; Function Call Method: A new object needs to be first $obj =new Uuapi; $obj->setsoftinfo (' 2097 ', ' b7ee76f547e34516bc30f6eb6c67c7db ');//How do I get these two values? Please check this page: Http://dll.uuwise.com/index.php?n=ApiDoc.GetSoftIDandKEY $obj->userlogin (' userName ', ' userpassword '); $result =autorecognition ($imagePath, $codeType); */class uuapi{private $softID;p rivate $softKEY;p rivate $userName; Private $userPassword;p rivate $uid;p rivate $userKey;p rivate $softContentKEY;p rivate $uuUrl;p rivate $uhash;p rivate $ uuversion= ' 1.1.0.1 ';p rivate $userAgent;p rivate $gkey;p ublic $macAddress = ' 00e021ac7d ';//client MAC address, server temporarily useless, Late preparation for binding MAC address assignment method: $obj->macaddress= ' 00e021ac7d '; Public $timeOut =60000;//Time-out, we recommend that you do not change this value assignment method: $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);p Reg_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! 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-&Gt;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 ' and ' $codeType '), $ver =array (' Version ' = '), "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): ' n '; $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 ' =&GT;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 ';}? >


Finally researched their API,
Now the recognition is basically omnipotent, the test picture


Reply to discussion (solution)

AD stickers? Baidu a bit this company, it is obviously artificial identification.

Reserved Doubts ~ ~

Please identify the captcha image: S+b=?

60 seconds, isn't it too long, and where can I use it? It's a lot more resources.

There is a profession called the network typist

It's still a very useful place.

60 seconds, isn't it too long, and where can I use it? It's a lot more resources.

Rob the train tickets, Rob Millet, all kinds of AH

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.