forked from sidcomua/php-anticaptcha
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrecognize-recaptcha-v2.php
executable file
·35 lines (27 loc) · 1.06 KB
/
recognize-recaptcha-v2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once realpath(dirname(dirname(__FILE__))) . '/vendor/autoload.php';
use AntiCaptcha\AntiCaptcha;
use AntiCaptcha\Task\RecaptchaV2Task;
use AntiCaptcha\Exception\AntiCaptchaException;
$apiKey = '********** API_KEY *************';
try {
$acClient = new AntiCaptcha(AntiCaptcha::SERVICE_ANTICAPTCHA, ['api_key' => $apiKey, 'debug' => true]);
$task = new RecaptchaV2Task(
"http://makeawebsitehub.com/recaptcha/test.php", // <-- target website address
"6LfI9IsUAAAAAKuvopU0hfY8pWADfR_mogXokIIZ" // <-- recaptcha key from target website
);
// If you need setup proxy
$task->setProxy(
"8.8.8.8",
1234,
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116",
"http",
"login",
"password",
null // also you can add cookie
);
$response = $acClient->recognizeTask($task);
echo $response['gRecaptchaResponse'];
} catch (AntiCaptchaException $exception) {
echo 'Error:' . $exception->getMessage();
}