我有以下代码用于recaptcha veryfication。
$curl = curl_init();
$postfields = array(
'secret' => '------Private Key------',
'response' => $_POST['g-recaptcha-response'],
);
var_dump($_POST['g-recaptcha-response']);
$options = array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://www.google.com/recaptcha/api/siteverify',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $postfields,
);
curl_setopt_array($curl, $options);
$response = json_decode(curl_exec($curl), true);
问题是我得到的响应总是为NULL,无论如何。有人可以帮我这个吗?感谢