検索
ホームページバックエンド開発PHPチュートリアル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 を調査しました
これで認識は基本的に普遍的になりました、テスト写真


ディスカッションに返信 (解決策)

広告投稿? Baidu がこの会社を調べたところ、明らかに手動での識別でした。

懐疑的な意見は保留してください~~

確認コードの画像を特定してください: s+b=?

60 秒は長すぎます。これはどこで使用できますか?これはより多くのリソースを消費します

ネットワーク タイピストという職業があります

それは今でも非常に便利です

60 秒は長すぎます、そしてこれはどこで使えますか?これにより、より多くのリソースが消費されます

電車のチケットを手に入れたり、Xiaomi を手に入れたり、あらゆる種類のものを手に入れましょう

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
PHP対Python:違いを理解しますPHP対Python:違いを理解しますApr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHPは、シンプルな構文と高い実行効率を備えたWeb開発に適しています。 2。Pythonは、簡潔な構文とリッチライブラリを備えたデータサイエンスと機械学習に適しています。

PHP:それは死にかけていますか、それとも単に適応していますか?PHP:それは死にかけていますか、それとも単に適応していますか?Apr 11, 2025 am 12:13 AM

PHPは死にかけていませんが、常に適応して進化しています。 1)PHPは、1994年以来、新しいテクノロジーの傾向に適応するために複数のバージョンの反復を受けています。 2)現在、電子商取引、コンテンツ管理システム、その他の分野で広く使用されています。 3)PHP8は、パフォーマンスと近代化を改善するために、JITコンパイラおよびその他の機能を導入します。 4)Opcacheを使用してPSR-12標準に従って、パフォーマンスとコードの品質を最適化します。

PHPの未来:適応と革新PHPの未来:適応と革新Apr 11, 2025 am 12:01 AM

PHPの将来は、新しいテクノロジーの傾向に適応し、革新的な機能を導入することで達成されます。1)クラウドコンピューティング、コンテナ化、マイクロサービスアーキテクチャに適応し、DockerとKubernetesをサポートします。 2)パフォーマンスとデータ処理の効率を改善するために、JITコンパイラと列挙タイプを導入します。 3)パフォーマンスを継続的に最適化し、ベストプラクティスを促進します。

PHPの抽象クラスまたはインターフェイスに対して、いつ特性を使用しますか?PHPの抽象クラスまたはインターフェイスに対して、いつ特性を使用しますか?Apr 10, 2025 am 09:39 AM

PHPでは、特性は方法が必要な状況に適していますが、継承には適していません。 1)特性により、クラスの多重化方法が複数の継承の複雑さを回避できます。 2)特性を使用する場合、メソッドの競合に注意を払う必要があります。メソッドの競合は、代替およびキーワードとして解決できます。 3)パフォーマンスを最適化し、コードメンテナビリティを改善するために、特性の過剰使用を避け、その単一の責任を維持する必要があります。

依存関係噴射コンテナ(DIC)とは何ですか?また、なぜPHPで使用するのですか?依存関係噴射コンテナ(DIC)とは何ですか?また、なぜPHPで使用するのですか?Apr 10, 2025 am 09:38 AM

依存関係噴射コンテナ(DIC)は、PHPプロジェクトで使用するオブジェクト依存関係を管理および提供するツールです。 DICの主な利点には、次のものが含まれます。1。デカップリング、コンポーネントの独立したもの、およびコードの保守とテストが簡単です。 2。柔軟性、依存関係を交換または変更しやすい。 3.テスト可能性、単体テストのために模擬オブジェクトを注入するのに便利です。

通常のPHPアレイと比較して、SPL SPLFIXEDARRAYとそのパフォーマンス特性を説明してください。通常のPHPアレイと比較して、SPL SPLFIXEDARRAYとそのパフォーマンス特性を説明してください。Apr 10, 2025 am 09:37 AM

SplfixedArrayは、PHPの固定サイズの配列であり、高性能と低いメモリの使用が必要なシナリオに適しています。 1)動的調整によって引き起こされるオーバーヘッドを回避するために、作成時にサイズを指定する必要があります。 2)C言語アレイに基づいて、メモリと高速アクセス速度を直接動作させます。 3)大規模なデータ処理とメモリに敏感な環境に適していますが、サイズが固定されているため、注意して使用する必要があります。

PHPは、ファイルを安全に処理する方法をどのように処理しますか?PHPは、ファイルを安全に処理する方法をどのように処理しますか?Apr 10, 2025 am 09:37 AM

PHPは、$ \ _ファイル変数を介してファイルのアップロードを処理します。セキュリティを確保するための方法には次のものが含まれます。1。アップロードエラー、2。ファイルの種類とサイズを確認する、3。ファイル上書きを防ぐ、4。ファイルを永続的なストレージの場所に移動します。

Null Coulescingオペレーター(??)およびNull Coulescing Assignment Operator(?? =)とは何ですか?Null Coulescingオペレーター(??)およびNull Coulescing Assignment Operator(?? =)とは何ですか?Apr 10, 2025 am 09:33 AM

JavaScriptでは、nullcoalescingoperator(??)およびnullcoalescingsignmentoperator(?? =)を使用できます。 1.??最初の非潜水金または非未定されたオペランドを返します。 2.??これらの演算子は、コードロジックを簡素化し、読みやすさとパフォーマンスを向上させます。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強力な PHP 統合開発環境

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター