Php &引用;在访问之前检查浏览器…”;使用Curl时出错

Php &引用;在访问之前检查浏览器…”;使用Curl时出错,php,html,parsing,curl,Php,Html,Parsing,Curl,我正在尝试使用curl从网站上获取内容。我得到的错误是 “访问Roostertooth.com前检查浏览器” 我尝试在curl中更改不同的属性,但仍然没有成功。我曾经尝试过使用PHP简单HTML-Dom解析器,但还是没有成功 下面是我当前的代码 <?php $divContents = array(); $userAgent = 'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0'; $html = curl

我正在尝试使用curl从网站上获取内容。我得到的错误是

“访问Roostertooth.com前检查浏览器”

我尝试在curl中更改不同的属性,但仍然没有成功。我曾经尝试过使用PHP简单HTML-Dom解析器,但还是没有成功

下面是我当前的代码

<?php
$divContents = array();
$userAgent = 'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0';
$html = curl_init("http://roosterteeth.com/home.php");
curl_setopt($html, CURLOPT_RETURNTRANSFER, true);
curl_setopt($html, CURLOPT_BINARYTRANSFER, true);
curl_setopt($html, CURLOPT_USERAGENT, $userAgent);
curl_setopt($html, CURLOPT_SSL_VERIFYPEER, false);
$content = curl_exec($html);
foreach($content->find("div.streamIndividual") as $div) {
$divContents[] = $div->outertext; }
file_put_contents("cache.htm", implode(PHP_EOL, $divContents));
$hash = file_get_contents("pg_1_hash.htm");
$cache = file_get_contents("cache.htm");
if ($hash == ($pageHash = md5($test))) {
} else {
$fpa = fopen("pg_1.htm", "w");
fwrite($fpa, $cache);
fclose($fpa);
$fpb = fopen("pg_1_hash.htm", "w");
fwrite($fpb, $pageHash);
fclose($fpb);
}
?>

由于find命令无法获取任何内容,上面的代码显示了不同的错误。下面的代码显示了我从该站点得到的错误

<?php
$divContents = array();
$userAgent = 'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0';
$html = curl_init("http://roosterteeth.com/home.php");
curl_setopt($html, CURLOPT_RETURNTRANSFER, true);
curl_setopt($html, CURLOPT_BINARYTRANSFER, true);
curl_setopt($html, CURLOPT_USERAGENT, $userAgent);
curl_setopt($html, CURLOPT_SSL_VERIFYPEER, false);
$content = curl_exec($html);
echo $content;
?>

我对这个错误的预感是服务器认为我是一个机器人(我不怪它这么认为)。我用curl来看看我是否可以假装成客户,绕过检查程序,但没有成功。我希望有人能对此有所了解

有关视觉错误,请单击此按钮


感谢您的时间:)

如果您试图访问的站点使用wordpress,则肯定存在安全问题。这是一个已知的恶意修改WP并将用户重定向到一些不同的站点。因此,在这种情况下,问题不在您的代码中。

站点检查cookies,如果它不存在,请设置cookies并重定向浏览器。。。。您需要激活Cookie以进行卷曲传输。但看起来cookies将由javascript设置。。。