-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhcaptcha.php
executable file
·52 lines (43 loc) · 1.61 KB
/
hcaptcha.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/php
<?php
require('lib/imagetyperzapi.php'); // load API library
function test_api() {
# grab token from https://imagetyperz.com
$access_token = 'your_access_token';
$i = new ImagetyperzAPI($access_token); // init API lib obj
$balance = $i->account_balance(); // get balance
echo "Balance: $balance\n";
echo "Solving captcha ...\n";
$params = array();
$params['page_url'] = 'https://your-site.com';
$params['sitekey'] = '1c7062c7-cae6-4e12-96fb-303fbec7fe4f';
//$params['invisible'] = '1'; // if captcha is invisible - optional
// domain used in loading of hcaptcha interface, default: hcaptcha.com - optional
// $params['domain'] = 'hcaptcha.com';
// extra parameters, useful for enterprise
// submit userAgent from requests too, when this is used
// $params['HcaptchaEnterprise'] = array(
// "rqdata" => "take value from web requests"
// );
//$params['proxy'] = '126.45.34.53:123'; // - optional
//$params['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'; // - optional
$captcha_id = $i->submit_hcaptcha($params);
echo "Waiting for captcha to be solved...\n";
$response = null;
while($response === null) {
sleep(10);
$response = $i->retrieve_response($captcha_id);
}
echo "Response: ";
var_dump($response);
}
// Main method
function main() {
try {
test_api(); // test API
} catch (Exception $ex) {
echo "Error occured: " . $ex->getMessage(); // print error
}
}
main(); // run main function
?>