首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

页面抓取!该如何处理

2012-02-27 
页面抓取!我想要抓取http://www.56110.cn/goods/list_p1.html?goodtype1这个页面下的货运信息,如何把每条

页面抓取!
我想要抓取http://www.56110.cn/goods/list_p1.html?goodtype=1这个页面下的货运信息,如何把每条信息中的详细信息都抓取到(就是查看里面的信息),帮忙看看,谢谢!

[解决办法]

PHP code
<?php $str = file_get_contents("http://www.56110.cn/goods/list_p1.html?goodtype=1");preg_match_all("/\<a\s+href\=\'(.*?)\'.*?\>.*?\<\/a\>/",$str,$match);print_r($match[1]);echo "<br>";foreach ($match[1] as $val){    $url= 'http://www.56110.cn'.$val;    $str = file_get_contents($url);    echo $str;    break;}?>
[解决办法]
探讨
PHP code
<?php
$str = file_get_contents("http://www.56110.cn/goods/list_p1.html?goodtype=1");
preg_match_all("/\<a\s+href\=\'(.*?)\'.*?\>.*?\<\/a\>/",$str,$match);
print_r($match[1]);
echo "<br>……

热点排行