Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!";
Expand Down
12 changes: 5 additions & 7 deletions src/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
]
]);

Expand Down
32 changes: 5 additions & 27 deletions src/ArCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@

class ArCaptcha
{
use WidgetOptions;

/**
* 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
Expand All @@ -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
Expand All @@ -80,7 +58,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);

Expand Down