“访问前检查浏览器..“错误,使用卷发


"Checking browser before accessing..." error when using Curl

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

"在访问 roosterteeth.com 之前检查浏览器"

我尝试在卷曲中更改不同的属性,但仍然没有运气。我尝试使用PHP Simple HTML Dom Parser,但再次没有运气。

下面是我当前的代码。

<?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);
}
?>

就目前而言,由于查找命令无法获取任何内容,上面的代码显示了不同的错误。下面的代码显示了我从该网站收到的错误。

<?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的已知恶意修改,并将用户重定向到一些不同的站点。因此,在这种情况下,问题不在于您的代码。