News新闻

业界新闻动态、技术前沿
Who are we?

您的位置:首页      乐道系统FAQ      PHP正则+Snoopy抓取框架实现的抓取淘宝店信誉功能实例

PHP正则+Snoopy抓取框架实现的抓取淘宝店信誉功能实例

发布日期:2017-05-17 00:00:00 87

本文实例讲述了PHP正则+Snoopy抓取框架实现的抓取淘宝店信誉功能。分享给大家供大家参考,具体如下:

<?php
header("Content-Type:text/html;charset=gbk");
include "Snoopy.class.php";
$snoopy = new Snoopy;
$snoopy->fetch("http://rate.taobao.com/user-rate-f01d9cb1245a22fcea470c11665de90e.htm?spm=0.0.0.37.TOtKhZ");
$html=$snoopy->results;
//echo $html;
//var_dump($html);
preg_match('/<ul class=\"sep\">\s*<li>[\w\W]*align=\"absmiddle\" class=\"rank\" \/><\/a><\/li>/',$html,$result);
//preg_match_all('/<div\sid=\"([a-z0-9_]+)\">([^<>]+)<\/div>/',$html,$result);
var_dump($result);
echo "<br>";