url="http://captchabot.com/xmlrpc/axmlrpc.php"; $this->host="captchabot.com"; $this->Username=""; $this->Password=""; } function Recognize($file, $language=0) { $s2=''; $contents=file_get_contents($file); if (!$contents) return 200; $converted=base64_encode($contents); $request="ocr_server::analyze"; $request.="$converted"; $request.="".$this->Username.""; $request.="".$this->Password.""; $request.="".$language.""; $request.=""; //return $request; $header[] = "Host: ".$this->host; $header[] = "MIME-Version: 1.0"; $header[] = "Content-type: multipart/mixed; boundary=----doc"; $header[] = "Accept: text/xml"; $header[] = "Content-length: ".strlen($request); $[$×èõEheader[] = "Cache-Control: no-cache"; $header[] = "Connection: close \r\n"; $header[] = $request; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$this->url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 140); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST'); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $data = curl_exec($ch); if (curl_errno($ch)) { return "300"; } $npos=strpos($data,""); if ($npos) { $start=$npos+strlen(""); $s1=substr($data,$start); $npos=strpos($s1,""); if ($npos) { $s2=substr($s1,0,$npos); } } $text=$s2; $npos=strpos($data,""); if ($npos) { $start=$npos+strlen(""); $s1=substr($data,$start); $npos=strpos($s1,""); if ($npos) { $s2=substr($s1,0,$npos); } } $this->id=$s2; return $text; } function Report($result) { $request="ocr_server::ver"; $request.=($result)?"yes":"no"; $request.="".$this->id.""; $header[] = "Host: ".$this->host; $header[] = "MIME-Version: 1.0"; $header[] = "Content-type: multipart/mixed; boundary=----doc"; $header[] = "Accept: text/xml"; $header[] = "Content-length: ".strlen($request); $header[] = "Cache-Control: no-cache"; $header[] = "Connection: close \r\n"; $header[] = $request; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$this->url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST'); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $data = curl_exec($ch); if (curl_errno($ch)) { return false; } else { return true; } } } ?>