PHP截取语句修改求助!高手请进
我想把以下的代码中“ http://d.zhaoxi.net/rs.php?q=”改为“ http://www.zhaoxi.net/s?wd=”,改了之后截取内容的语句也要跟着修改,我要截取百度的搜索页面底部的“相关搜索”的关键词,我自己修改不正确,郁闷中,烦请哪位高人帮忙修改正确的语句并回贴,感激不尽。谢谢!!!PHP语句如下--
<?php
$key = "a|b|c|d";
//开始抓取百度热门关键词
$splitkey = explode("|", $key);
$keynum=count($splitkey);
for($i=0;$i<=$keynum-1;$i++)
{
$keyword=$splitkey[$i];
$keywords=iconv("UTF-8","GBK",$keyword);
$url = " http://d.zhaoxi.net/rs.php?q=".$keywords."&tn=baidu";
$openurl = @file_get_contents($url);
//$openurl=iconv("GBK","UTF-8",$openurl);
$start=strpos($openurl,"<li class=ls>1</li>");
$end=strpos($openurl,"<li class=ls>6</li>");
$len=$end-$start;
$content=substr($openurl,$start,$len); //截取得指定内容
$content2 = explode("<img", $content);
//划分数组
for($p=0; $p<4; $p++)
{
$key = $content2[$p];
$start2=strpos($key,"baidur");//取得内容的截取段
$end2=strpos($key,"</li><li class=bar>");
$len2=$end2-$start2;
$content3=substr($key,$start2,$len2); //截取得指定内容
$content3 = str_replace("baidur>","",$content3);
$content3 = str_replace("</a>","kkxzkkxz",$content3);
$content4=$content4.$content3;
}
}
//抓取百度热门关键词结束
?>