如何从curl请求中删除Google验证码?

时间:2019-10-13 04:04:41

标签: php curl recaptcha

我正在尝试从一个网站中删除数据。但是问题是当我发送CURL请求时,每次都会显示google recaptcha。

我如何删除此安全检查。

这是我的代码:

$url = 'https://www.zillow.com/browse/homes/ca/';

$data = array(
    'secret' => "my-secret",
    'response' => "my-response"
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result=curl_exec ($ch);
curl_close ($ch);

echo '<pre>';
print_r($result); 
echo '</pre>';
exit;

1 个答案:

答案 0 :(得分:1)

这是不可能的(至少不能轻易做到)

reCAPTCHA的用例是严格禁止您在做什么。
但是,某些站点仅在未发送用户代理标头的情况下才请求reCAPTCHA。
试试

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'
));

这将使站点认为您正在Windows 7上使用Firefox 47