搜索引擎 <META http-equiv=Content-Type content="text/html; charset=gb2312"> <LINK href="css.css" type=text/css rel=stylesheet> 欢迎使用超级搜索引擎,请输入你想搜索的关键字。 <?php /* * 小强制作http://www.phpcode.net */ echo '<form>'; echo '<input type="text" name="string">'; echo '<input type="submit" value="搜索">'; echo "</form>"; if (isset($string)) { $url = "http://search.163.com/cgi-bin/search/engine/search2.fcgi?lang=all&key=$string"; $str = implode("",file($url)); $aa= explode("<B>",$str); $bb=$aa[2]; $cc=explode("<TR BGCOLOR=9FA4EE>",$bb); $dd=$cc[0]; $ee=explode("/cgi-bin/search/engine",$dd); $ff=implode("http://search.163.com//cgi-bin/search/engine",$ee); $gg=explode("<!--LIST END-->",$ff); $hh=$gg[0]; echo "你所检索的关键字是<font color=red>$string</font> ,共有"; $ii=explode("</B></TD></TR>",$hh); $jj=explode("of",$ii[0]); echo "<font color=red>$jj[1]</font>"; echo "条记录<br>"; echo $hh; echo "<br><br><br>"; echo "共有"; echo "<font color=red>"; $kk=substr("$jj[1]",0,-1); $ll=$jj[1]; $mm=$ll/$kk; if($mm==10) { echo $kk; } else{ echo $kk+1; } echo "</font>"; echo " 页,目前最大只能查到99页"; echo '<form>'; echo '跳到第<input type="text" name="page" size=4>'; echo "<input type=hidden name=key value=$string>"; echo "<input type=hidden name=key_a value=$mm>"; echo "<input type=hidden name=key_b value=$kk>"; echo '页<input type="submit" value="go">'; echo "</form>"; } if (isset($page)) { $url="http://search.163.com/cgi-bin/search/engine/search2.fcgi?page=$page&key=$key&CAT=&lang=all"; $str = implode("",file($url)); $aa= explode("<B>",$str); $bb=$aa[2]; $cc=explode("<TR BGCOLOR=9FA4EE>",$bb); $dd=$cc[0]; $ee=explode("/cgi-bin/search/engine",$dd); $ff=implode("http://search.163.com//cgi-bin/search/engine",$ee); $gg=explode("<!--LIST END-->",$ff); $hh=$gg[0]; echo $hh; echo "<br><br><br>"; echo "共有"; echo "<font color=red>"; if($key_a==10) { echo $key_b; } else{ echo $key_b+1; } echo "</font>"; echo " 页,这是第<font color=red>$page</font> 页"; echo '<form>'; echo '跳到第<input type="text" name="page" size=4>'; echo "<input type=hidden name=key value=$key>"; echo "<input type=hidden name=key_a value=$key_a>"; echo "<input type=hidden name=key_b value=$key_b>"; echo '页<input type="submit" value="go">'; echo "</form>"; } ?>