Hello,
I’m having issues with https://www.google.com/recaptcha/api/siteverify. I’m calling this via cUrl from a php laravel app. I’m using php 8.3
Here is the cUrl function which I’m using
$captchaResults = Utility::curlCall( 'https://www.google.com/recaptcha/api/siteverify', 'POST', $captchaParams);
public static function curlCall( $url, $type = 'GET', $arguments = [], $encodeData = false, $returnHeaders = false) { $type = strtoupper($type); if ($type == 'GET') { $url .= '?'.http_build_query($arguments); } $curl_request = curl_init($url); if ($type == 'POST') { curl_setopt($curl_request, CURLOPT_POST, 1); } elseif ($type == 'PUT') { curl_setopt($curl_request, CURLOPT_CUSTOMREQUEST, 'PUT'); } elseif ($type == 'DELETE') { curl_setopt($curl_request, CURLOPT_CUSTOMREQUEST, 'DELETE'); } curl_setopt($curl_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($curl_request, CURLOPT_HEADER, $returnHeaders); curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_request, CURLOPT_FOLLOWLOCATION, 0); if (! empty($arguments) && $type !== 'GET') { if ($encodeData) { // encode the arguments as JSON $arguments = json_encode($arguments); } curl_setopt($curl_request, CURLOPT_POSTFIELDS, $arguments); } $result = curl_exec($curl_request); if ($returnHeaders) { // set headers from response [$headers, $content] = explode("\r\n\r\n", $result, 2); foreach (explode("\r\n", $headers) as $header) { header($header); } return trim($content); } $httpCode = curl_getinfo($curl_request, CURLINFO_HTTP_CODE); curl_close($curl_request); // decode the response from JSON $response = json_decode($result); return ['code' => $httpCode, 'response' => $response];}I’m getting the error “OpenSSL SSL_read: OpenSSL/3.5.0: error:0A000126:SSL routines::unexpected eof while reading, errno 0” There is no code change in cUrl or on how its called. After searching for a while i got to know that upon commenting below line works.
curl_setopt($curl_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
But I want to understand what happened suddenly that it stopped working.