为什么recaptcha的响应为空?

时间:2016-08-10 06:19:35

标签: php recaptcha

PHP

$ch = curl_init();
$options = [
    CURLOPT_URL => 'https://www.google.com/recaptcha/api/siteverify',
    CURLOPT_POST => 1,
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POSTFIELDS => [
        'secret' => 'key',
        'response' => $_POST['g-recaptcha-response'],
    ],
];

curl_setopt_array($ch,$options);

$out = curl_exec($ch) ;
$a = json_decode($out);
var_dump($a);

当我填写recaptcha时,它在此文件中仅返回null。这是api或下载recaptcha包的最佳选择。

0 个答案:

没有答案