Home >Backend Development >PHP Tutorial >抓取1688网站内容不行,抓别的站可以。

抓取1688网站内容不行,抓别的站可以。

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-20 12:32:23771browse

测试网址
https://detail.1688.com/offer/520938481930.html?spm=a260k.635.199825914.5.MRicAH
要求能取到网页html代码即可。

我取到的始终只有一行
<script>top.location.href='/login.php';</script>
怀疑是做了防抓取的处理。


不管用什么方法,只要取得真正的商品页面html代码就行,谢谢。


回复讨论(解决方案)

看提示的意思是不是必须让登录 ?
如果用CURL模拟登录后再试呢。

curl_setopt($ch,CURLOPT_POSTFIELDS,$post_file);  ////传递一个作为HTTP "POST"操作的所有数据的字符串。
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);  /////把返回来的cookie信息保存在$cookie_jar文件中
curl_exec($ch);///执行
curl_close($ch);////关闭

看提示的意思是不是必须让登录 ?
如果用CURL模拟登录后再试呢。

curl_setopt($ch,CURLOPT_POSTFIELDS,$post_file);  ////传递一个作为HTTP "POST"操作的所有数据的字符串。
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);  /////把返回来的cookie信息保存在$cookie_jar文件中
curl_exec($ch);///执行
curl_close($ch);////关闭



你分析的有道理,可是对我并没有什么用,要能取到才行。
Statement:
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