2015-01-31 42 views
1

我想使用卷曲从网站上获取内容。我得到的错误是。使用卷曲“检查浏览器前访问...”错误使用卷曲

我试图改变在卷曲不同的属性,但仍没有运气

“访问roosterteeth.com之前检查你的浏览器”。我曾尝试使用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); 
} 
?> 

因为它的立场上面的代码显示了不同的错误,由于找到命令不能够获得任何内容。下面的代码显示我从网站获得的错误。

<?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看看我是否可以假装成一个客户,绕过检查器,但没有成功。我希望有人能够阐明这一点。

对于视觉误差点击这个link.

感谢您的时间:)

+0

该网站检查cookie,如果它不存在,设置cookie和重定向浏览器....你需要激活cookies以进行CURL传输。但它看起来Cookie将由JavaScript设置... – Eugen 2015-01-31 22:21:34

回答

-1

如果你想访问的网站使用WordPress的,它是definetly存在安全隐患。它是一种已知的WP恶意修改,并将用户重定向到一些不同的网站。所以在这种情况下,问题不在你的代码中。