PHP Classes

File: src/examples/exampleImageToText.php

Recommend this page to a friend!
  Classes of Roman Kozin   PHP Anti-CAPTCHA   src/examples/exampleImageToText.php   Download  
File: src/examples/exampleImageToText.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Anti-CAPTCHA
Decode form values with CAPTCHA with anti-CAPTCHA
Author: By
Last change:
Date: 6 years ago
Size: 575 bytes
 

Contents

Class file image Download
<?php
namespace AntiCaptcha;

$api = new ImageToText();
$api->setVerboseMode(true);
       
//your anti-captcha.com account key
$api->setKey("12345678901234567890123456789012");

//setting file
$api->setFile("./capcha.jpg");

if (!
$api->createTask()) {
   
$api->debout("API v2 send failed - ".$api->getErrorMessage(), "red");
    return
false;
}

$taskId = $api->getTaskId();


if (!
$api->waitForResult()) {
   
$api->debout("could not solve captcha", "red");
   
$api->debout($api->getErrorMessage());
} else {
    echo
"\nhash result: ".$api->getTaskSolution()."\n\n";
}