I made some changes to ReCaptcha \ RequestMethod \ Post.php from Google API
class Post implements RequestMethod
{
const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
public function submit(RequestParameters $params)
{
$cafile = dirname(__DIR__) . '/RequestMethod/ca-bundle.crt';
$peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
$options = array(
'ssl' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => $params->toQueryString(),
'cafile' => $cafile,
'verify_peer' => true,
'verify_peer_name' => true,
$peer_key => 'www.google.com',
),
);
$context = stream_context_create($options);
return file_get_contents(self::SITE_VERIFY_URL, false, $context);
}
}
I added the following lines to the array and renamed it from http to ssl
'cafile' => $cafile
'verify_peer_name' => true
Now the error in my next question has disappeared. link to the question
New error: ["missing-input-response", "missing-input-secret"]
When I debug the $ params parameters from the submit method, there is an answer and a secret key there.
Thanks for the help :)
source
share