Skip to content

Commit ad4251e

Browse files
authored
RC-2363 Add new API methods (#20)
* Added Tencent support * Add Tencent to README.md * Added MTCaptcha support * Add Cutcaptcha support * Added Friendly Captcha support * Added atbCAPTCHA support * Added DataDome support
1 parent ef13477 commit ad4251e

15 files changed

Lines changed: 533 additions & 5 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,7 @@ $RECYCLE.BIN/
6969
.Trash-*
7070

7171
# .nfs files are created when an open file is removed but is still being accessed
72-
.nfs*
72+
.nfs*
73+
74+
# PHPUnit cache
75+
.phpunit.result.cache

README.md

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ Examples of API requests for different captcha types are available on the [PHP c
1515
- [Composer](#composer)
1616
- [Manual](#manual)
1717
- [Configuration](#configuration)
18+
- [TwoCaptcha instance options](#twocaptcha-instance-options)
1819
- [Solve captcha](#solve-captcha)
20+
- [Captcha options](#captcha-options)
1921
- [Normal Captcha](#normal-captcha)
20-
- [Text](#text-captcha)
22+
- [Text Captcha](#text-captcha)
2123
- [ReCaptcha v2](#recaptcha-v2)
2224
- [ReCaptcha v3](#recaptcha-v3)
2325
- [FunCaptcha](#funcaptcha)
@@ -26,7 +28,7 @@ Examples of API requests for different captcha types are available on the [PHP c
2628
- [hCaptcha](#hcaptcha)
2729
- [KeyCaptcha](#keycaptcha)
2830
- [Capy](#capy)
29-
- [Grid (ReCaptcha V2 Old Method)](#grid)
31+
- [Grid](#grid)
3032
- [Canvas](#canvas)
3133
- [ClickCaptcha](#clickcaptcha)
3234
- [Rotate](#rotate)
@@ -35,14 +37,20 @@ Examples of API requests for different captcha types are available on the [PHP c
3537
- [Lemin](#lemin)
3638
- [Turnstile](#turnstile)
3739
- [AmazonWaf](#amazonwaf)
40+
- [Tencent](#tencent)
41+
- [MTCaptcha](#mtcaptcha)
42+
- [Cutcaptcha](#cutcaptcha)
43+
- [Friendly Captcha](#friendly-captcha)
44+
- [atbCAPTCHA](#atbcaptcha)
45+
- [DataDome](#datadome)
3846
- [Other methods](#other-methods)
3947
- [send / getResult](#send--getresult)
4048
- [balance](#balance)
4149
- [report](#report)
4250
- [Proxies](#proxies)
4351
- [Error handling](#error-handling)
44-
- [Get in touch](#get-in-touch)
45-
- [Join the team 👪](#join-the-team-)
52+
- [Get in touch](#get-in-touch)
53+
- [Join the team 👪](#join-the-team-)
4654

4755

4856
## Installation
@@ -249,6 +257,82 @@ $result = $solver->amazon_waf([
249257
]);
250258
```
251259

260+
### Tencent
261+
262+
Use this method to bypass Tencent.
263+
264+
```php
265+
$result = $solver->tencent([
266+
'sitekey' => '123456789',
267+
'url' => 'https://www.site.com/page/',
268+
]);
269+
```
270+
271+
272+
### MTCaptcha
273+
274+
Use this method to bypass MTCaptcha.
275+
276+
```php
277+
$result = $solver->mt_captcha([
278+
'sitekey' => 'MTPublic-KzqLY1cKH',
279+
'url' => 'https://2captcha.com/demo/mtcaptcha',
280+
]);
281+
```
282+
283+
### Cutcaptcha
284+
285+
Use this method to bypass Cutcaptcha.
286+
287+
```php
288+
$result = $solver->cutcaptcha([
289+
'misery_key' => 'a1488b66da00bf332a1488993a5443c79047e752',
290+
'api_key' => 'SAb83IIB',
291+
'url' => 'https://example.cc/foo/bar.html',
292+
]);
293+
```
294+
295+
### Friendly Captcha
296+
297+
Use this method to bypass Friendly Captcha.
298+
299+
```php
300+
$result = $solver->friendly_captcha([
301+
'sitekey' => '2FZFEVS1FZCGQ9',
302+
'url' => 'https://example.com/',
303+
]);
304+
```
305+
306+
### atbCAPTCHA
307+
308+
Use this method to bypass atbCAPTCHA.
309+
310+
```php
311+
$result = $solver->atb_captcha([
312+
'sitekey' => 'af23e041b22d000a11e22a230fa8991c',
313+
'api_server' => 'https://cap.aisecurius.com',
314+
'url' => 'https://example.com/',
315+
]);
316+
```
317+
318+
### DataDome
319+
320+
Use this method to bypass DataDome.
321+
322+
```php
323+
$result = $solver->datadome([
324+
'captcha_url' => 'af23e041b22d000a11e22a230fa8991c',
325+
'userAgent' => 'https://cap.aisecurius.com',
326+
'url' => 'https://example.com/',
327+
'proxy' => [
328+
'type' => 'HTTPS',
329+
'uri' => 'username:str0ngP@$$W0rd@1.2.3.4:4321',
330+
],
331+
]);
332+
```
333+
334+
335+
252336
## Other methods
253337

254338
### send / getResult

examples/atb_captcha.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
set_time_limit(130);
4+
5+
require(__DIR__ . '/../src/autoloader.php');
6+
7+
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
8+
9+
try {
10+
$result = $solver->atb_captcha([
11+
'sitekey' => 'af23e041b22d000a11e22a230fa8991c',
12+
'api_server' => 'https://cap.aisecurius.com',
13+
'url' => 'https://example.com/',
14+
]);
15+
} catch (\Exception $e) {
16+
die($e->getMessage());
17+
}
18+
19+
die('Captcha solved: ' . $result->code);

examples/cutcaptcha.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
set_time_limit(130);
4+
5+
require(__DIR__ . '/../src/autoloader.php');
6+
7+
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
8+
9+
try {
10+
$result = $solver->cutcaptcha([
11+
'misery_key' => 'a1488b66da00bf332a1488993a5443c79047e752',
12+
'api_key' => 'SAb83IIB',
13+
'url' => 'https://example.cc/foo/bar.html',
14+
]);
15+
} catch (\Exception $e) {
16+
die($e->getMessage());
17+
}
18+
19+
die('Captcha solved: ' . $result->code);

examples/datadome.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
set_time_limit(130);
4+
5+
require(__DIR__ . '/../src/autoloader.php');
6+
7+
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
8+
9+
try {
10+
$result = $solver->datadome([
11+
'captcha_url' => 'https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA...P~XFrBVptk&t=fe&referer=https%3A%2F%2Fhexample.com&s=45239&e=c538be..c510a00ea',
12+
'userAgent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
13+
'url' => 'https://example.com/',
14+
'proxy' => [
15+
'type' => 'HTTPS',
16+
'uri' => 'username:str0ngP@$$W0rd@1.2.3.4:4321',
17+
],
18+
]);
19+
} catch (\Exception $e) {
20+
die($e->getMessage());
21+
}
22+
23+
die('Captcha solved: ' . $result->code);

examples/friendly_captcha.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
set_time_limit(130);
4+
5+
require(__DIR__ . '/../src/autoloader.php');
6+
7+
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
8+
9+
try {
10+
$result = $solver->friendly_captcha([
11+
'sitekey' => '2FZFEVS1FZCGQ9',
12+
'url' => 'https://example.com/',
13+
]);
14+
} catch (\Exception $e) {
15+
die($e->getMessage());
16+
}
17+
18+
die('Captcha solved: ' . $result->code);

examples/mt_captcha.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
set_time_limit(130);
4+
5+
require(__DIR__ . '/../src/autoloader.php');
6+
7+
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
8+
9+
try {
10+
$result = $solver->mt_captcha([
11+
'sitekey' => 'MTPublic-KzqLY1cKH',
12+
'url' => 'https://2captcha.com/demo/mtcaptcha',
13+
]);
14+
} catch (\Exception $e) {
15+
die($e->getMessage());
16+
}
17+
18+
die('Captcha solved: ' . $result->code);

examples/tencent.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
set_time_limit(130);
4+
5+
require(__DIR__ . '/../src/autoloader.php');
6+
7+
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
8+
9+
try {
10+
$result = $solver->tencent([
11+
'sitekey' => '123456789',
12+
'url' => 'https://www.site.com/page/',
13+
]);
14+
} catch (\Exception $e) {
15+
die($e->getMessage());
16+
}
17+
18+
die('Captcha solved: ' . $result->code);

src/TwoCaptcha.php

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,110 @@ public function capy($captcha)
344344
return $this->solve($captcha);
345345
}
346346

347+
/**
348+
* Wrapper for solving Tencent
349+
*
350+
* @param $captcha
351+
* @return \stdClass
352+
* @throws ApiException
353+
* @throws NetworkException
354+
* @throws TimeoutException
355+
* @throws ValidationException
356+
*/
357+
public function tencent($captcha)
358+
{
359+
$captcha['method'] = 'tencent';
360+
361+
return $this->solve($captcha);
362+
}
363+
364+
/**
365+
* Wrapper for solving MTCaptcha
366+
*
367+
* @param $captcha
368+
* @return \stdClass
369+
* @throws ApiException
370+
* @throws NetworkException
371+
* @throws TimeoutException
372+
* @throws ValidationException
373+
*/
374+
public function mt_captcha($captcha)
375+
{
376+
$captcha['method'] = 'mt_captcha';
377+
378+
return $this->solve($captcha);
379+
}
380+
381+
/**
382+
* Wrapper for solving Cutcaptcha
383+
*
384+
* @param $captcha
385+
* @return \stdClass
386+
* @throws ApiException
387+
* @throws NetworkException
388+
* @throws TimeoutException
389+
* @throws ValidationException
390+
*/
391+
public function cutcaptcha($captcha)
392+
{
393+
$captcha['method'] = 'cutcaptcha';
394+
395+
return $this->solve($captcha);
396+
}
397+
398+
/**
399+
* Wrapper for solving Friendly Captcha
400+
*
401+
* @param $captcha
402+
* @return \stdClass
403+
* @throws ApiException
404+
* @throws NetworkException
405+
* @throws TimeoutException
406+
* @throws ValidationException
407+
*/
408+
public function friendly_captcha($captcha)
409+
{
410+
$captcha['method'] = 'friendly_captcha';
411+
412+
return $this->solve($captcha);
413+
}
414+
415+
/**
416+
* Wrapper for solving atbCAPTCHA
417+
*
418+
* @param $captcha
419+
* @return \stdClass
420+
* @throws ApiException
421+
* @throws NetworkException
422+
* @throws TimeoutException
423+
* @throws ValidationException
424+
*/
425+
public function atb_captcha($captcha)
426+
{
427+
$captcha['method'] = 'atb_captcha';
428+
429+
return $this->solve($captcha);
430+
}
431+
432+
433+
/**
434+
* Wrapper for solving DataDome
435+
*
436+
* @param $captcha
437+
* @return \stdClass
438+
* @throws ApiException
439+
* @throws NetworkException
440+
* @throws TimeoutException
441+
* @throws ValidationException
442+
*/
443+
public function datadome($captcha)
444+
{
445+
$captcha['method'] = 'datadome';
446+
447+
return $this->solve($captcha);
448+
}
449+
450+
347451
/**
348452
* Wrapper for solving grid captcha
349453
*
@@ -801,6 +905,12 @@ private function getParamsMap($method)
801905
'capy' => [
802906
'sitekey' => 'captchakey',
803907
],
908+
'tencent' => [
909+
'sitekey' => 'app_id',
910+
],
911+
'atb_captcha' => [
912+
'sitekey' => 'app_id',
913+
],
804914
];
805915

806916
if (isset($methodMap[$method])) {

0 commit comments

Comments
 (0)