Home  >  Article  >  Backend Development  >  页面抓取!该如何处理

页面抓取!该如何处理

WBOY
WBOYOriginal
2016-06-13 13:50:29778browse

页面抓取!
我想要抓取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\=\'(.*?)\'.*?\>.*?\/",$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;
}
?>
<br><font color="#e78608">------解决方案--------------------</font><br>
探讨
PHP code
$str = file_get_contents("http://www.56110.cn/goods/list_p1.html?goodtype=1");
preg_match_all("/\.*?\/",$str,$match);
print_r($match[1]);
echo "
……
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