【发布时间】:2020-04-25 20:29:54
【问题描述】:
我正在为 Google Recaptcha 使用 PHP 包装库。
https://packagist.org/packages/google/recaptcha
我需要设置一个代理,但在我调查时,这个库不支持代理配置。
有没有人有机会为 Google Recaptcha 成功配置代理配置?
这是在没有代理的服务器上正常工作的代码
/**
* RecaptchaService constructor.
*
* @param ReCaptcha $recaptcha
*/
public function __construct(ReCaptcha $recaptcha)
{
$this->recaptcha = $recaptcha;
}
/**
* @param array $data
*
* @return bool
*/
public function validateCaptcha(array $data): bool
{
$response = $this->recaptcha->verify($data['gRecaptchaResponse'], $data['clientIp']);
return $response->isSuccess() || \PHP_SAPI === 'cli';
}
我猜应该在verify 方法调用之前或内部配置代理。
【问题讨论】:
标签: php symfony security proxy recaptcha