diff --git a/README.md b/README.md index 6105836..250aff4 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ $solver = new \TwoCaptcha\TwoCaptcha([ 'defaultTimeout' => 120, 'recaptchaTimeout' => 600, 'pollingInterval' => 10, + 'json' => 1, ]); ``` @@ -92,11 +93,12 @@ $solver = new \TwoCaptcha\TwoCaptcha([ | Option | Default value | Description | | ---------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -| softId | 4585 | your software ID obtained after publishing in [2captcha software catalog] | +| softId | 4585 | your software ID obtained after publishing in [2captcha software catalog] | | callback | - | URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account | | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint | | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint | | pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended | +| json | 0 | Json or String format response from `res.php` API endpoint, json = 1 returns JSON format response | > [!IMPORTANT] > Once `callback` is defined for `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL. @@ -444,6 +446,18 @@ $result = $solver->cybersiara([ ]); ``` +### hCaptcha + +[API method description.](https://2captcha.com/2captcha-api#hCaptcha) + +Use this method to bypass hCaptcha. + +```php +$result = $solver->hcaptcha([ + 'sitekey' => 'c0421d06-b92e-47fc-ab9a-5caa43c04538', + 'url' => 'https://api.solvecaptcha.com/demo/hcaptcha' +]); +``` ## Other methods diff --git a/examples/h_captcha.php b/examples/h_captcha.php new file mode 100644 index 0000000..cd709df --- /dev/null +++ b/examples/h_captcha.php @@ -0,0 +1,22 @@ + 'YOUR_API_KEY', + 'server' => 'http://2captcha.com', + 'json' => 1 +]); + +try { + $result = $solver->hcaptcha([ + 'sitekey' => 'c0421d06-b92e-47fc-ab9a-5caa43c04538', + 'url' => 'https://api.solvecaptcha.com/demo/hcaptcha' + ]); +} catch (\Exception $e) { + die($e->getMessage()); +} + +die('Captcha solved: ' . $result->code); \ No newline at end of file diff --git a/src/ApiClient.php b/src/ApiClient.php index dd9e76e..ced9d75 100644 --- a/src/ApiClient.php +++ b/src/ApiClient.php @@ -18,7 +18,8 @@ class ApiClient * ApiClient constructor. * @param $options string */ - public function __construct($options) { + public function __construct($options) + { if (is_string($options)) { $this->server = $options; } @@ -101,7 +102,7 @@ private function execute() throw new NetworkException(curl_error($this->curl)); } - if (mb_strpos($response, 'ERROR_') === 0) { + if (strpos(json_encode($response), 'ERROR_') !== false) { throw new ApiException($response); } diff --git a/src/TwoCaptcha.php b/src/TwoCaptcha.php index 901796f..5f22428 100644 --- a/src/TwoCaptcha.php +++ b/src/TwoCaptcha.php @@ -80,6 +80,12 @@ class TwoCaptcha */ private $apiClient; + + /** + * JSON response + */ + private $json = 0; + /** * TwoCaptcha constructor. * @param $options string|array @@ -99,6 +105,7 @@ public function __construct($options) if (!empty($options['defaultTimeout'])) $this->defaultTimeout = $options['defaultTimeout']; if (!empty($options['recaptchaTimeout'])) $this->recaptchaTimeout = $options['recaptchaTimeout']; if (!empty($options['pollingInterval'])) $this->pollingInterval = $options['pollingInterval']; + if (!empty($options['json'])) $this->json = $options['json']; $this->apiClient = new ApiClient($this->server); } @@ -494,10 +501,10 @@ public function canvas($captcha) $this->requireFileOrBase64($captcha); $captcha['method'] = empty($captcha['base64']) ? 'post' : 'base64'; - $captcha['recaptcha']=1; + $captcha['recaptcha'] = 1; $captcha['canvas'] = 1; - if ( empty($captcha['hintText']) && empty($captcha['hintImg']) ) { + if (empty($captcha['hintText']) && empty($captcha['hintImg'])) { throw new ValidationException('At least one of parameters: hintText or hintImg required!'); } @@ -540,7 +547,8 @@ public function coordinates($captcha) * @throws TimeoutException * @throws ValidationException */ - public function audio($captcha){ + public function audio($captcha) + { if (is_string($captcha)) { if (!file_exists($captcha)) { throw new ValidationException('File not found (' . $captcha . ')'); @@ -681,13 +689,48 @@ public function send($captcha) $response = $this->apiClient->in($captcha, $files); + $jsonObj = json_decode($response, true); + + if (json_last_error() === JSON_ERROR_NONE) { + $request = $jsonObj['request']; + $status = $jsonObj['status']; + + if ($request == "CAPCHA_NOT_READY") { + return null; + } + + if ($status == 1) { + return $request; + } + } else { + + if (mb_strpos($response, 'OK|') !== 0) { + throw new ApiException('Cannot recognise api response (' . $response . ')'); + } + + return mb_substr($response, 3); + } + } + + /* victor todo: remove + public function send($captcha) + { + $this->sendAttachDefaultParams($captcha); + + $files = $this->extractFiles($captcha); + + $this->mapParams($captcha, $captcha['method']); + $this->mapParams($files, $captcha['method']); + + $response = $this->apiClient->in($captcha, $files); + if (mb_strpos($response, 'OK|') !== 0) { throw new ApiException('Cannot recognise api response (' . $response . ')'); } return mb_substr($response, 3); } - +*/ /** * Returns result of captcha if it was solved or `null`, if result is not ready * @@ -701,17 +744,35 @@ public function getResult($id) $response = $this->res([ 'action' => 'get', 'id' => $id, + 'json' => $this->json, ]); - if ($response == 'CAPCHA_NOT_READY') { - return null; - } + $jsonObj = json_decode($response, true); - if (mb_strpos($response, 'OK|') !== 0) { - throw new ApiException('Cannot recognise api response (' . $response . ')'); - } + if (json_last_error() === JSON_ERROR_NONE) { + $request = $jsonObj['request']; + $status = $jsonObj['status']; - return mb_substr($response, 3); + + if ($request == "CAPCHA_NOT_READY") { + return null; + } + + if ($status == 1) { + return $response; + } + } else { + + if ($response == 'CAPCHA_NOT_READY') { + return null; + } + + if (mb_strpos($response, 'OK|') !== 0) { + throw new ApiException('Cannot recognise api response (' . $response . ')'); + } + + return mb_substr($response, 3); + } } /** @@ -772,6 +833,7 @@ private function res($query) private function sendAttachDefaultParams(&$captcha) { $captcha['key'] = $this->apiKey; + $captcha['json'] = $this->json; if ($this->callback) { if (!isset($captcha['callback'])) { diff --git a/tests/AbstractWrapperTestCase.php b/tests/AbstractWrapperTestCase.php index 11d2c7c..c52c6b2 100644 --- a/tests/AbstractWrapperTestCase.php +++ b/tests/AbstractWrapperTestCase.php @@ -23,6 +23,7 @@ protected function checkIfCorrectParamsSendAndResultReturned($data) $apiKey = 'API_KEY'; $captchaId = '123'; $code = '2763'; + $json = '0'; $apiClient = $this->createMock(ApiClient::class); @@ -40,7 +41,7 @@ protected function checkIfCorrectParamsSendAndResultReturned($data) $apiClient ->expects($this->once()) ->method('res') - ->with($this->equalTo(['action' => 'get', 'id' => $captchaId, 'key' => $apiKey])) + ->with($this->equalTo(['action' => 'get', 'id' => $captchaId, 'key' => $apiKey, 'json' => $json])) ->willReturn('OK|' . $code); $solver = new TwoCaptcha([ diff --git a/tests/AmazonWafTest.php b/tests/AmazonWafTest.php index 7f00011..c0cbd70 100644 --- a/tests/AmazonWafTest.php +++ b/tests/AmazonWafTest.php @@ -28,6 +28,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/AtbCaptchaTest.php b/tests/AtbCaptchaTest.php index 48f7d44..7022d25 100644 --- a/tests/AtbCaptchaTest.php +++ b/tests/AtbCaptchaTest.php @@ -26,6 +26,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/AudioTest.php b/tests/AudioTest.php index 84ba00d..718e58e 100644 --- a/tests/AudioTest.php +++ b/tests/AudioTest.php @@ -21,6 +21,7 @@ public function test() 'method' => 'audio', 'body' => base64_encode(file_get_contents($audio)), 'soft_id' => '4585', + 'json' => '0' ]; @@ -47,6 +48,7 @@ public function testAllParameters() 'body' => base64_encode(file_get_contents($audio)), 'lang' => 'ru', 'soft_id' => '4585', + 'json' => '0' ]; diff --git a/tests/CanvasTest.php b/tests/CanvasTest.php index b5140e1..32e11d2 100644 --- a/tests/CanvasTest.php +++ b/tests/CanvasTest.php @@ -22,7 +22,7 @@ public function testSingleFileParameter() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['file' => $this->captchaImg, 'hintText' => $this->hintText], - 'sendParams' => ['method' => 'post', 'canvas' => 1, 'recaptcha' => 1, 'textinstructions' => $this->hintText, 'soft_id' => '4585'], + 'sendParams' => ['method' => 'post', 'canvas' => 1, 'recaptcha' => 1, 'textinstructions' => $this->hintText, 'soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -31,7 +31,7 @@ public function testBase64() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['base64' => '...', 'hintText' => $this->hintText], - 'sendParams' => ['method' => 'base64', 'canvas' => 1, 'body' => '...', 'recaptcha' => 1, 'textinstructions' => $this->hintText, 'soft_id' => '4585'], + 'sendParams' => ['method' => 'base64', 'canvas' => 1, 'body' => '...', 'recaptcha' => 1, 'textinstructions' => $this->hintText, 'soft_id' => '4585', 'json' => '0'], 'sendFiles' => [], ]); } @@ -58,6 +58,7 @@ public function testAllParameters() 'recaptcha' => 1, 'textinstructions' => $this->hintText, 'soft_id' => '4585', + 'json' => '0' ]; $sendFiles = [ diff --git a/tests/CapyTest.php b/tests/CapyTest.php index 8d9e8a2..871bc39 100644 --- a/tests/CapyTest.php +++ b/tests/CapyTest.php @@ -18,6 +18,7 @@ public function testAllOptions() 'captchakey' => 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v', 'pageurl' => 'http://mysite.com/', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/CoordinatesTest.php b/tests/CoordinatesTest.php index 0159200..1bbf0ed 100644 --- a/tests/CoordinatesTest.php +++ b/tests/CoordinatesTest.php @@ -12,7 +12,7 @@ public function testSingleFile() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => $this->captchaImg, - 'sendParams' => ['method' => 'post', 'coordinatescaptcha' => 1, 'soft_id' => '4585'], + 'sendParams' => ['method' => 'post', 'coordinatescaptcha' => 1, 'soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -21,7 +21,7 @@ public function testSingleFileParameter() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['file' => $this->captchaImg], - 'sendParams' => ['method' => 'post', 'coordinatescaptcha' => 1,'soft_id' => '4585'], + 'sendParams' => ['method' => 'post', 'coordinatescaptcha' => 1,'soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -30,7 +30,7 @@ public function testBase64() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['base64' => '...'], - 'sendParams' => ['method' => 'base64', 'coordinatescaptcha' => 1, 'body' => '...','soft_id' => '4585'], + 'sendParams' => ['method' => 'base64', 'coordinatescaptcha' => 1, 'body' => '...','soft_id' => '4585', 'json' => '0'], 'sendFiles' => [], ]); } @@ -52,6 +52,7 @@ public function testAllParameters() 'lang' => 'en', 'textinstructions' => 'Select all images with an Orange', 'soft_id' => '4585', + 'json' => '0' ]; $sendFiles = [ diff --git a/tests/CutcaptchaTest.php b/tests/CutcaptchaTest.php index b70c7d9..693a9c2 100644 --- a/tests/CutcaptchaTest.php +++ b/tests/CutcaptchaTest.php @@ -26,6 +26,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/CyberSiaraTest.php b/tests/CyberSiaraTest.php index 34e2241..5a8f1f2 100644 --- a/tests/CyberSiaraTest.php +++ b/tests/CyberSiaraTest.php @@ -26,6 +26,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/DatadomeTest.php b/tests/DatadomeTest.php index 6acec6f..8afd20c 100644 --- a/tests/DatadomeTest.php +++ b/tests/DatadomeTest.php @@ -26,6 +26,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/FriendlyCaptchaTest.php b/tests/FriendlyCaptchaTest.php index d4e927f..8e9b375 100644 --- a/tests/FriendlyCaptchaTest.php +++ b/tests/FriendlyCaptchaTest.php @@ -24,6 +24,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/FunCaptchaTest.php b/tests/FunCaptchaTest.php index f345ba2..e641bef 100644 --- a/tests/FunCaptchaTest.php +++ b/tests/FunCaptchaTest.php @@ -30,6 +30,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/GeeTest.php b/tests/GeeTest.php index 9766155..a814066 100644 --- a/tests/GeeTest.php +++ b/tests/GeeTest.php @@ -28,6 +28,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/GeeTestV4.php b/tests/GeeTestV4.php index 960b2bc..b967b06 100644 --- a/tests/GeeTestV4.php +++ b/tests/GeeTestV4.php @@ -26,6 +26,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; diff --git a/tests/GridTest.php b/tests/GridTest.php index a77fc13..5967420 100644 --- a/tests/GridTest.php +++ b/tests/GridTest.php @@ -12,7 +12,7 @@ public function testSingleFile() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => $this->captchaImg, - 'sendParams' => ['method' => 'post','soft_id' => '4585'], + 'sendParams' => ['method' => 'post','soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -21,7 +21,7 @@ public function testSingleFileParameter() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['file' => $this->captchaImg], - 'sendParams' => ['method' => 'post','soft_id' => '4585'], + 'sendParams' => ['method' => 'post','soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -30,7 +30,7 @@ public function testBase64() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['base64' => '...'], - 'sendParams' => ['method' => 'base64', 'body' => '...','soft_id' => '4585'], + 'sendParams' => ['method' => 'base64', 'body' => '...','soft_id' => '4585', 'json' => '0'], 'sendFiles' => [], ]); } @@ -59,6 +59,7 @@ public function testAllParameters() 'lang' => 'en', 'textinstructions' => 'Select all images with an Orange', 'soft_id' => '4585', + 'json' => '0' ]; $sendFiles = [ diff --git a/tests/HCaptchaTest.php b/tests/HCaptchaTest.php index 9f59b75..ad2b62d 100644 --- a/tests/HCaptchaTest.php +++ b/tests/HCaptchaTest.php @@ -23,7 +23,8 @@ public function testAllOptions() 'pageurl' => 'https://www.site.com/page/', 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', - 'soft_id' => '4585', + 'soft_id' => 4585, + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/KeyCaptchaTest.php b/tests/KeyCaptchaTest.php index f146378..89545f5 100644 --- a/tests/KeyCaptchaTest.php +++ b/tests/KeyCaptchaTest.php @@ -30,6 +30,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/LeminTest.php b/tests/LeminTest.php index 851ff41..22c1a86 100644 --- a/tests/LeminTest.php +++ b/tests/LeminTest.php @@ -26,6 +26,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/MTCaptchaTest.php b/tests/MTCaptchaTest.php index 4b52179..c79ddcc 100644 --- a/tests/MTCaptchaTest.php +++ b/tests/MTCaptchaTest.php @@ -24,6 +24,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/NormalTest.php b/tests/NormalTest.php index 778e617..97e7a45 100644 --- a/tests/NormalTest.php +++ b/tests/NormalTest.php @@ -12,7 +12,7 @@ public function testSingleFile() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => $this->captchaImg, - 'sendParams' => ['method' => 'post','soft_id' => '4585'], + 'sendParams' => ['method' => 'post','soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -21,7 +21,7 @@ public function testSingleFileParameter() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['file' => $this->captchaImg], - 'sendParams' => ['method' => 'post','soft_id' => '4585'], + 'sendParams' => ['method' => 'post','soft_id' => '4585', 'json' => '0'], 'sendFiles' => ['file' => $this->captchaImg], ]); } @@ -30,7 +30,7 @@ public function testBase64() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['base64' => '...'], - 'sendParams' => ['method' => 'base64', 'body' => '...','soft_id' => '4585'], + 'sendParams' => ['method' => 'base64', 'body' => '...','soft_id' => '4585', 'json' => '0'], 'sendFiles' => [], ]); } @@ -63,6 +63,7 @@ public function testAllParameters() 'lang' => 'en', 'textinstructions' => 'Type red symbols only', 'soft_id' => '4585', + 'json' => '0' ]; $sendFiles = [ diff --git a/tests/ReCaptchaTest.php b/tests/ReCaptchaTest.php index e99085f..4a4cfd7 100644 --- a/tests/ReCaptchaTest.php +++ b/tests/ReCaptchaTest.php @@ -28,6 +28,7 @@ public function testV2() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ @@ -55,6 +56,7 @@ public function testV3() 'action' => 'verify', 'min_score' => 0.3, 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/RotateTest.php b/tests/RotateTest.php index 64c47c3..f4d3d94 100644 --- a/tests/RotateTest.php +++ b/tests/RotateTest.php @@ -25,6 +25,7 @@ public function testAllParameters() 'textinstructions' => 'Put the images in the correct way up', 'body' => '...', 'soft_id' => '4585', + 'json' => '0' ]; $sendFiles = [ diff --git a/tests/TencentTest.php b/tests/TencentTest.php index cb70549..3604844 100644 --- a/tests/TencentTest.php +++ b/tests/TencentTest.php @@ -24,6 +24,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/TextTest.php b/tests/TextTest.php index 2737955..c3fcaf2 100644 --- a/tests/TextTest.php +++ b/tests/TextTest.php @@ -10,7 +10,7 @@ public function testSimpleText() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => 'Today is monday?', - 'sendParams' => ['method' => 'post', 'textcaptcha' => 'Today is monday?','soft_id' => '4585'], + 'sendParams' => ['method' => 'post', 'textcaptcha' => 'Today is monday?','soft_id' => '4585','json' => '0'], 'sendFiles' => [], ]); } @@ -19,7 +19,7 @@ public function testTextParameter() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['text' => 'Today is monday?'], - 'sendParams' => ['method' => 'post', 'textcaptcha' => 'Today is monday?','soft_id' => '4585'], + 'sendParams' => ['method' => 'post', 'textcaptcha' => 'Today is monday?','soft_id' => '4585','json' => '0'], 'sendFiles' => [], ]); } @@ -28,7 +28,7 @@ public function testAllParameters() { $this->checkIfCorrectParamsSendAndResultReturned([ 'params' => ['text' => 'Today is monday?', 'lang' => 'en'], - 'sendParams' => ['method' => 'post', 'textcaptcha' => 'Today is monday?', 'lang' => 'en','soft_id' => '4585'], + 'sendParams' => ['method' => 'post', 'textcaptcha' => 'Today is monday?', 'lang' => 'en','soft_id' => '4585','json' => '0'], 'sendFiles' => [], ]); } diff --git a/tests/TurnstileTest.php b/tests/TurnstileTest.php index 457c86b..e4f51ee 100644 --- a/tests/TurnstileTest.php +++ b/tests/TurnstileTest.php @@ -24,6 +24,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([ diff --git a/tests/YandexTest.php b/tests/YandexTest.php index dc71cab..a8f5965 100644 --- a/tests/YandexTest.php +++ b/tests/YandexTest.php @@ -24,6 +24,7 @@ public function testAllOptions() 'proxy' => 'username:str0ngP@$$W0rd@1.2.3.4:4321', 'proxytype' => 'HTTPS', 'soft_id' => '4585', + 'json' => '0' ]; $this->checkIfCorrectParamsSendAndResultReturned([