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

页面抓取!该如何处理

WBOY
Release: 2016-06-13 13:50:29
Original
867 people have browsed it

页面抓取!
我想要抓取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>
Copy after login
探讨
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 "
……
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