PHP搜索功能很多地方都用到,所以模拟了下GOOGLE查询。
 
 参考了网上其他资料。
 
<body bgcolor=lightyellow toptargin=30>
<table border=0 bgcolor=lightyellow align=center>
 <tr align="center"><td align="center">
<center>
<form>
<input type="text" name="keyword" size="30">
<input type="submit" name="submit1" value="GOOGLE 搜索">
</form>
</center>
</td></tr></table></body>
<?php
    @$keyword=urlencode($_GET[keyword]);//URL编码,防止出现乱码  
   //这个GOOGLE 默认的 GET传递方式。
$urlvalue="[url]http://www.google.cn/search?hl=zh-CN&q=[/url]".$keyword."&btnG=Google+%E6%90%9C%E7%B4%A2&meta=&aq=f";
 
$result=file($urlvalue); //取得数组
$result_str=join(" ",$result); //组合一句
//根据页面结构。找出要提取字符。
$result_str_array=explode("<p>",$result_str); //分割字符串<p> 后字符
$newstring=explode("</p>",$result_str_array[1]); //再次提取字符
@$br_array=explode("<br>",$newstring[1]);
//去掉GOOGLE特殊标示
echo "<table border=1 align='center'>";
for($i=0;$i<count($br_array)-1;$i++)
  {
   $br_array[$i]=str_replace("翻译此页","",$br_array[$i]);
   $br_array[$i]=str_replace("网页快照","",$br_array[$i]);
   $br_array[$i]=str_replace("-","",$br_array[$i]);
   $br_array[$i]=str_replace("类似网页","",$br_array[$i]);
   preg_match_all('/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/i',$br_array[$i],$newresult);
   //网站连接地址
   @$linkstr=$newresult[2][2];
   //echo 连接字符表面
   $linkname="<font size=4 color=lightred>".@$newresult[4][2]."</font>";
   echo "<br>";
   //组合显示
   $total="<a href=".$linkstr;
   $total=$total." target=_blank style='text-decoration:none'>".$linkname."</a>";
   echo $total;
   echo "<br>";
  }
echo "</table>"; 
?>
 刚刚实现了功能,还得去进一步修改。附件是个查询出来的图片。