Reputation: 113
I am using http://www.question2answer.org/ software and standard plugin there for captcha. I tried to update software and after the upgrade I keep getting this error. I have no idea how to fix this. I looked around, but nothing is related directly.
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /qa/qa-plugin/recaptcha-captcha/recaptchalib.php on line 128
Warning: file_get_contents(): Failed to enable crypto in /qa/qa-plugin/recaptcha-captcha/recaptchalib.php on line 128
Warning: file_get_contents( https://www.google.com/recaptcha/api/siteverify?secret=abc6LcMwv8SAAAAAN9QOkIlVKRQZzHS3DeZ8ZLxwxxcdsd-cs&response=03AOmkcwJV_JkhxK8hGJTIVKEDcPrNH5Y0wLwndp7v20Ipqd4HMO21LWHSyPsLFsdfdsfsdsdfsdA6FZ1LiFJZpl6-CmppsTAWc8Qzft_RXLvlzunzQtZWNDp0Kw8T-drMvHiOZf909v4ScysiPmaMrxkq_SSlJaOE_Q6sdfsdfdsfdsh5X7xLqvoFDFbV16BJBTkJ5Pot5ZDwmSGZSD_0pygTdEzh8j-tGuSpZLSDVJmQ7Xq6HR70Dd2idtKz_gfcIAZQisdfsdfdsfJHH1LyY3FAG_x9zHemy3tXF6oE7rWuBZ8JoHehkWhYYChe-cBbdSX1ZqPioNNaSvkREbooI7esdfsdfd3JkynEKlqnUBl3t__qpDMu&remoteip=12.102.238.217&version=php_1.1.2): failed to open stream: operation failed in /qa/qa-plugin/recaptcha-captcha/recaptchalib.php on line 128
I went to line 128 and this is what I see there. I see this line "return file_get_contents(self::SITE_VERIFY_URL . $params->toQueryString());".
I have got more code around that lines for your info.
/**
* Sends GET requests to the reCAPTCHA service.
*/
class ReCaptchaGetRequestMethod implements ReCaptchaRequestMethod{
const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify?';
/**
* Submit the request with the specified parameters.
*
* @param ReCaptchaRequestParameters $params Request parameters
* @return string Body of the reCAPTCHA response
*/
public function submit(ReCaptchaRequestParameters $params){
return file_get_contents(self::SITE_VERIFY_URL . $params->toQueryString());
}
}
Can you please help ? I tried few things like adding certificate in php.ini and it did not work. All of it was working fine, when I upgraded, it started to fail. All registrations are stuck. Please help.
Upvotes: 1
Views: 11731
Reputation: 113
The solution to the above is to use CURL based solution where you replace file_get_contents with CURL. Below is the new modified code. I have captured all in a step by step blog article with steps for everyone.
$url = self::SITE_VERIFY_URL . $params->toQueryString();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
curl_close($ch);
Upvotes: 0