Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function testImageToText($url) {
- $api = new ImageToText();
- $api->setVerboseMode(false);
- //your anti-captcha.com account key
- $api->setKey("xxxxxxxxxxxxxxxxxxxxxxx");
- $path = $_SERVER['DOCUMENT_ROOT'].'/crystal/captcha/' . $api->generateRandomString();
- file_put_contents($path, file_get_contents($url));
- //setting file
- $api->setFile($path);
- 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 {
- $captchaText = $api->getTaskSolution();
- return $captchaText;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement