Heim  >  Artikel  >  Backend-Entwicklung  >  哪位高手能用curl或file_get_contents获取这个网页的内容

哪位高手能用curl或file_get_contents获取这个网页的内容

WBOY
WBOYOriginal
2016-06-13 10:37:28692Durchsuche

谁能用curl或file_get_contents获取这个网页的内容?
http://zhaohongen.fu.cn8u.cn/v.html
如果能请不方法告诉我,不胜感激!!

------解决方案--------------------
他这是有一个点击后的跳转,不是自己写了个header跳转.
看了一下代码 其实就是掩人耳目

使用curl来访问。只需要 第一次访问这个页面保存好cookie 再刷新一次页面 带上cookie 即可.
完全使用cookie 来控制,试我就不试了

你可以在浏览器先打开 http://zhaohongen.fu.cn8u.cn/v.html 再打开一个tab 然后访问 http://zhaohongen.fu.cn8u.cn/v.html

内容就出来了,清除掉cookie 就又不行了 又得重复上面我说的步骤,所以只要控制了cookie就可以了

------解决方案--------------------
真纠结,,妞妞都说了,cookie问题

PHP code
$cookie_file = dirname(__FILE__).'/cookie.txt';if(!file_exists($cookie_file)){    $fp= fopen($cookie_file,"w");    fclose($fp);}$url = "http://zhaohongen.fu.cn8u.cn/v.html";$ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_COOKIEJAR,  $cookie_file); curl_exec($ch);curl_close($ch);$url = "http://zhaohongen.fu.cn8u.cn/v.html";$ch = curl_init($url);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); $response = curl_exec($ch);curl_close($ch);echo $response;<div class="clear">
                 
              
              
        
            </div>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn