用php抓取google关键词排名(2)
preg_match_all("$match", "$contents", $line);
while (list ($k, $v) = each($line[0])) {
preg_match_all("!<h3\s+class=\"r\"><a[^>]+>(.*?)</a>!", $v, $title);
$num = count($title[1]);
for ($i = 0; $i < $num; $i++) {
if (strstr($title[0][$i], $url_s)) {
$rsState = true;
$j = $i +1;
$sum = $j + (($page) * 10 - 10);
//echo $contents;
echo "关键字" . $keyword . "<br>" . "排名:" . '<font color="red" size="20" >' . $sum . '</font>' . "####" . "第" . '<font color="#00FFFF" size="18" >'.$page . '</font>'. " 页" . "第" .'<font color="#8000FF" size="15" >'.$j . '</font>'. "名" . $title[0][$i] . "<br>";
echo "<a href='" . $url . "'>" . "点击搜索结果" . "</a>" . "<br>";
相关新闻>>
- 发表评论
-
- 最新评论 更多>>