一个file_get_contents的有关问题

WBOY
Release: 2016-06-13 13:03:33
Original
715 people have browsed it

一个file_get_contents的问题
我在写19楼论坛的采集,为什么采集不到呢,谁能帮我看看,首先是用file_get_contents,但是为什么我file_get_contents之后,就是一段乱码,什么意思呀!

<br />
$url="http://www.19lou.com/forum-1366-thread-9501352334616489-1-1.html";<br />
<br />
$str=file_get_contents($url);<br />
<br />
echo $str;<br />
<br />
exit;<br />
Copy after login

但是我采集别的论坛,是可以的,是不是19楼做防采集呢
<br />
$url="http://www.caomeihui.com/thread-252-1-1.html";<br />
<br />
$str=file_get_contents($url);<br />
<br />
echo $str;<br />
<br />
exit;<br />
Copy after login

------最佳解决方案--------------------
我跟你是一样的结果,确实没辙了
------其他解决方案--------------------
在寻找答案中,
------其他解决方案--------------------
咋不用采集器的呢?
------其他解决方案--------------------
可能是编码不一致导致的。

------其他解决方案--------------------

引用:
我在写19楼论坛的采集,为什么采集不到呢,谁能帮我看看,首先是用file_get_contents,但是为什么我file_get_contents之后,就是一段乱码,什么意思呀!
PHP code12345678$url="http://www.19lou.com/forum-1366-thread-9501352334616489-1-1.html"; $str=fi……



你还能采到啊  为毛我用你的代码直接跳转到错误页面114导航上了  坑爹啊
------其他解决方案--------------------
这能说是乱码吗?


<script><br /> <br /> var url=document.location.href;<br /> var s = url.indexOf("?"); <br /> <br /> var redirectUrl='';<br /> var domain=document.domain.substr(document.domain.indexOf(".")+1);<br /> <br /> if(s>0)<br /> {<br /> redirectUrl=url.substr(s+1);<br /> SetCookie("_Z3nY0d4C_","37XgPK9h",365,"/",domain);<br /> document.location.href=redirectUrl;<br /> <br /> }<br /> else<br /> {<br /> <br /> document.location.href="http://www."+domain;<br /> }<br /> <br /> function SetCookie (name, value) { <br /> var expdate = new Date();<br /> var argv = SetCookie.arguments;<br /> var argc = SetCookie.arguments.length;<br /> var expires = (argc > 2) ? argv[2] : null;<br /> var path = (argc > 3) ? argv[3] : null;<br /> var domain = (argc > 4) ? argv[4] : null;<br /> var secure = (argc > 5) ? argv[5] : false;<br /> <br /> if(expires!=null && expires>=0) expdate.setTime(expdate.getTime() + ( expires * 24*60*60*1000 ));<br /> <br /> document.cookie = name + "=" + escape (value) +((expires == null <br><font color='#FF8000'>------其他解决方案--------------------<br> expires < 0) ? ((expires==-1)?"; expires=-1":"") : ("; expires="+ expdate.toGMTString()))<br /> +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))<br /> +((secure == true) ? "; secure" : "");<br /> }<br /> <br /> </script>

------其他解决方案--------------------
2楼的,人家19楼就是用了这个技术,才让我晕的不行行
------其他解决方案--------------------
引用:
这能说是乱码吗?


<script><br /> <br /> var url=document.location.href;<br /> var s = url.indexOf("?"); <div class="clear"> </script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!