Skip to content

Commit 9746055

Browse files
added geetestV4
1 parent a0b68b8 commit 9746055

File tree

3 files changed

+108
-1
lines changed

3 files changed

+108
-1
lines changed

geetestV4.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/php
2+
3+
<?php
4+
require('lib/imagetyperzapi.php'); // load API library
5+
6+
function test_api() {
7+
# grab token from https://imagetyperz.com
8+
$access_token = 'your_access_token';
9+
$i = new ImagetyperzAPI($access_token); // init API lib obj
10+
11+
$balance = $i->account_balance(); // get balance
12+
echo "Balance: $balance\n";
13+
14+
echo "Solving captcha ...\n";
15+
$params = array();
16+
$params['domain'] = 'https://example.com';
17+
$params['geetestid'] = '647f5ed2ed8acb4be36784e01556bb71';
18+
//$params['proxy'] = '126.45.34.53:123'; // - optional
19+
//$params['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'; // - optional
20+
$captcha_id = $i->submit_geetest_v4($params);
21+
echo "Waiting for captcha to be solved...\n";
22+
$response = null;
23+
while($response === null) {
24+
sleep(10);
25+
$response = $i->retrieve_response($captcha_id);
26+
}
27+
echo "Response: ";
28+
var_dump($response);
29+
}
30+
31+
// Main method
32+
function main() {
33+
try {
34+
test_api(); // test API
35+
} catch (Exception $ex) {
36+
echo "Error occured: " . $ex->getMessage(); // print error
37+
}
38+
}
39+
40+
main(); // run main function
41+
?>

lib/imagetyperzapi.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
define('BAD_IMAGE_ENDPOINT', 'http://captchatypers.com/Forms/SetBadImage.ashx');
99
define('PROXY_CHECK_ENDPOINT', 'http://captchatypers.com/captchaAPI/GetReCaptchaTextJSON.ashx');
1010
define('GEETEST_SUBMIT_ENDPOINT', 'http://captchatypers.com/captchaapi/UploadGeeTest.ashx');
11+
define('GEETEST_V4_SUBMIT_ENDPOINT', 'http://www.captchatypers.com/captchaapi/UploadGeeTestV4.ashx');
1112
define('GEETEST_SUBMIT_ENDPOINT_TOKEN', 'http://captchatypers.com/captchaapi/UploadGeeTestToken.ashx');
1213
define('RETRIEVE_JSON_ENDPOINT', 'http://captchatypers.com/captchaapi/GetCaptchaResponseJson.ashx');
1314
define('CAPY_ENDPOINT', 'http://captchatypers.com/captchaapi/UploadCapyCaptchaUser.ashx');
@@ -229,6 +230,46 @@ function submit_geetest($d) {
229230
return $response;
230231
}
231232

233+
function submit_geetest_v4($d) {
234+
$data = array(
235+
"action" => "UPLOADCAPTCHA",
236+
"domain" => $d['domain'],
237+
"geetestid" => $d['geetestid'],
238+
);
239+
240+
$url = GEETEST_V4_SUBMIT_ENDPOINT;
241+
242+
if (!empty($this->_username)) {
243+
$data["username"] = $this->_username;
244+
$data["password"] = $this->_password;
245+
} else {
246+
$data['token'] = $this->_access_token;
247+
}
248+
249+
// affiliate
250+
if (!empty($this->_affiliate_id)) {
251+
$data['affiliateid'] = $this->_affiliate_id;
252+
}
253+
254+
// check for proxy
255+
if (isset($d['proxy'])) {
256+
// we have a good proxy here (at least both params supplied)
257+
// set it to the data/params
258+
$data["proxy"] = $d['proxy'];
259+
}
260+
// check for user agent
261+
if (isset($d['user_agent'])) $data["useragent"] = $d['user_agent'];
262+
$q = http_build_query($d);
263+
$url = "$url?$q";
264+
$response = Utils::post($url, $data, USER_AGENT, $this->_timeout);
265+
if (strpos($response, 'ERROR:') !== false) {
266+
throw new Exception(trim(explode('ERROR:', $response)[1]));
267+
}
268+
// we have a good response here
269+
// save captcha to obj and return solved text
270+
return $response;
271+
}
272+
232273
function submit_capy($d) {
233274
$data = array(
234275
"action" => "UPLOADCAPTCHA",

readme.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ imagetyperzapi is a super easy to use bypass captcha API wrapper for imagetyperz
55

66
## Installation
77
composer require imagetyperzapi/imagetyperzapi
8-
8+
99
or
1010

1111
git clone https://github.com/imagetyperz-api/imagetyperz-api-php
@@ -126,6 +126,31 @@ $captcha_id = $i->submit_geetest($params);
126126

127127
Optionally, you can send proxy and user_agent along.
128128

129+
### GeeTestV4
130+
131+
GeeTesV4 is a new version of captcha from geetest that requires 2 parameters to be solved:
132+
133+
- domain
134+
- geetestid (captchaID) - gather this from HTML source of page with captcha, inside the `<script>` tag you'll find a link that looks like this: https://i.imgur.com/XcZd47y.png
135+
136+
The response of this captcha after completion are 5 parameters:
137+
138+
- captcha_id
139+
- lot_number
140+
- pass_token
141+
- gen_time
142+
- captcha_output
143+
144+
```php
145+
$params = array();
146+
$params['domain'] = 'https://example.com';
147+
$params['geetestid'] = '647f5ed2ed8acb4be36784e01556bb71';
148+
$captcha_id = $i->submit_geetest_v4($params);
149+
```
150+
151+
Optionally, you can send proxy and user_agent along.
152+
153+
129154
### hCaptcha
130155

131156
Requires page_url and sitekey

0 commit comments

Comments
 (0)