From 0af132facc9e047d3700ad56c29aae15223f79cb Mon Sep 17 00:00:00 2001 From: Aref Date: Sat, 11 Jun 2022 16:02:35 +0430 Subject: [PATCH 1/2] @ Changes parameters to work with .co domain --- README.md | 2 +- src/Adapter/Http.php | 12 +++++------- src/ArCaptcha.php | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1ada58d..1a9effd 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ After the post, use the class to verify the response. You get true or false back: ```php -if ($ArCaptcha->verify($_POST["arcaptcha-token"])) { +if ($ArCaptcha->verify($_POST["arcaptcha-response"])) { echo "OK!"; } else { echo "FAILED!"; diff --git a/src/Adapter/Http.php b/src/Adapter/Http.php index c1c5e23..7c16c1f 100644 --- a/src/Adapter/Http.php +++ b/src/Adapter/Http.php @@ -3,8 +3,6 @@ namespace Mohammadv184\ArCaptcha\Adapter; use GuzzleHttp\Exception\GuzzleException; -use GuzzleHttp\Exception\RequestException; -use phpDocumentor\Reflection\Types\True_; class Http implements Adapter { @@ -50,13 +48,13 @@ public function __construct(string $site_key, string $secret_key, string $base_u * @return array * @throws GuzzleException */ - public function submit(string $uri, string $challenge_id):array + public function submit(string $uri, string $challenge_id): array { $response = $this->client->post($uri, [ - 'json'=>[ - 'challenge_id' => $challenge_id, - 'site_key' => $this->site_key, - 'secret_key' => $this->secret_key + 'json' => [ + 'response' => $challenge_id, + 'sitekey' => $this->site_key, + 'secret' => $this->secret_key ] ]); diff --git a/src/ArCaptcha.php b/src/ArCaptcha.php index bf59d0f..1c16085 100644 --- a/src/ArCaptcha.php +++ b/src/ArCaptcha.php @@ -11,13 +11,13 @@ class ArCaptcha * Api Base Uri * @var string */ - protected $api_base_uri = 'https://arcaptcha.ir/2/'; + protected $api_base_uri = 'https://arcaptcha.co/2/'; /** * Script Url * @var string */ - protected $script_url = 'https://widget.arcaptcha.ir/1/api.js'; + protected $script_url = 'https://widget.arcaptcha.co/2/api.js'; /** * User Site Key @@ -80,7 +80,7 @@ public function __construct(string $site_key, string $secret_key, array $options $this->color = $options['color'] ?? 'normal'; $this->lang = $options['lang'] ?? 'fa'; $this->size = $options['size'] ?? 'normal'; - $this->size = $options['theme'] ?? 'light'; + $this->theme = $options['theme'] ?? 'light'; $this->callback = $options['callback'] ?? ''; $this->http = new Http($this->site_key, $this->secret_key, $this->api_base_uri); From f46881c39921eb6012daffc9e0ac1d424966cbbf Mon Sep 17 00:00:00 2001 From: taymaz <75164763+taymazmostafaei@users.noreply.github.com> Date: Sat, 31 Dec 2022 21:30:24 +0330 Subject: [PATCH 2/2] Update ArCaptcha.php --- src/ArCaptcha.php | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/ArCaptcha.php b/src/ArCaptcha.php index 1c16085..b358e0a 100644 --- a/src/ArCaptcha.php +++ b/src/ArCaptcha.php @@ -7,6 +7,8 @@ class ArCaptcha { + use WidgetOptions; + /** * Api Base Uri * @var string @@ -31,30 +33,6 @@ class ArCaptcha */ protected $secret_key; - /** - * Widget Color - * @var string - */ - protected $color; - - /** - * Widget Language - * @var string - */ - protected $lang; - - /** - * Widget size (invisible or normal) - * @var string - */ - protected $size; - - /** - * Widget theme - * @var string - */ - protected $theme; - /** * Callback function name after challenge is solved * @var string