Home  >  Article  >  Backend Development  >  这个如何采集,有点难倒小弟我了

这个如何采集,有点难倒小弟我了

WBOY
WBOYOriginal
2016-06-13 13:49:19775browse

这个怎么采集,有点难倒我了
http://app.baidu.com/appweb/c?cid=1

我想得到小游戏的的连接地址,和图标连接,

还请指点一下。

------解决方案--------------------
file_get_contents();把内容采集到本地。再通过正则过滤。。
------解决方案--------------------
加个user-agent的header看看
------解决方案--------------------
$con = file_get_contents('http://app.baidu.com/appweb/c?cid=1');
preg_match_all('/class="app-single-item"[\s\S]*?href="([^"]*?)"[\s\S]*?src="([^"]*?)"/',$con,$match);
var_dump($match[2]);
------解决方案--------------------
有变化啊。http://app.baidu.com/appweb/c?cid=1&leaf_cid=&sort=1&pn=2
pn代表页数
------解决方案--------------------

探讨

不是的我要的是这个连接下面http://app.baidu.com/appweb/c?cid=1
打开网页最下面的页码数对应的内容,

也就是最新,最热的游戏 。
引用:

有变化啊。http://app.baidu.com/appweb/c?cid=1&leaf_cid=&sort=1&pn=2……

------解决方案--------------------
不过我看了下他返回的好像是json数据。你再从json里面提取出规则就行了
------解决方案--------------------
为什么叫我卧龙???
我是用firebug这个插件看的,是firefox上的一个插件,这个插件可以看到浏览器http连接的信息
你把http://app.baidu.com/appweb/getcathotlist?cid=1&leaf_cid=0&sort=1&pn=2这个直接在地址栏里请求看看就知道是json了
------解决方案--------------------
探讨

因为知道很多。引用:

为什么叫我卧龙???
我是用firebug这个插件看的,是firefox上的一个插件,这个插件可以看到浏览器http连接的信息
你把http://app.baidu.com/appweb/getcathotlist?cid=1&leaf_cid=0&sort=1&pn=2这个……

------解决方案--------------------
探讨

谢谢,谢谢

------解决方案--------------------
卧龙大哥~
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