In response to your last comment, I understand that you cannot change Google reCaptcha api- I meant just to file_get_contentsactually do example.com(it exists) as a test to find out if you can get any using this method, since some web hosts disable related functionality.
API reCatcha Google file_get_contents, , context SSL.
$secret = 'Your google secret';
$captcha = trim( $_POST['g-recaptcha-response'] );
$ip = $_SERVER['REMOTE_ADDR'];
$url = "https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$captcha}&remoteip={$ip}";
$options=array(
'ssl'=>array(
'cafile' => '/path/to/cacert.pem',
'verify_peer' => true,
'verify_peer_name' => true,
),
);
$context = stream_context_create( $options );
$res=json_decode( file_get_contents( $url, FILE_TEXT, $context ) );
if( $res->success ){}
else{ }
cacert.pem ca-bundle.crt . cafile - , .