要怎么才有这个功能呢....把下面这些放数据库?html部分要怎么写才能接入了?
<?php
if($_GET['wd']!=""){
$wd = $_GET['wd'];
}else{
$wd = "%BE%DB%B5%E3%C9%CC%CE%F1%CD%F8";
}
if(mb_detect_encoding($wd)=="UTF-8"){
$wd = iconv("utf-8","gb2312",$wd);
}
$pn = $_GET[pn];$url = "http://baidu.hljsql.com/?wd=".urlencode($wd)."&pn=".$pn;
$r = file($url);
$r = implode('', $r);
$r = iconv("","utf-8",$r);
eregi("<!--title_(.*)_/title-->",$r,$title);
eregi("<!--接口开始-->(.*)<!--接口结束-->",$r,$r1);
eregi("<pn1>(.*)</pn1>",$r,$pn1);
eregi("<Page>(.*)</Page>",$r,$Page);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="<?=$title[1]?>-<?=$_GET['pn']?>">
<meta name="Description" content="<?=$title[1]?>-<?=$_GET['pn']?>">
<title><?=$title[1]?>-<?=$_GET['pn']?></title>
<style>
em{ color:#F00; }
a{ text-decoration:none; }
</style>
</head>
<body><form action="?" method="get"><input name="wd" type="text" id="wd" value="<?=$title[1];?>" /><input name="搜索" type="submit" id="搜索" value="搜索" />
</form>
<table width="100%" border="1">
<tr>
<td>关键词:<?=$title[1];?></td>
<td><a href="http://www.baidu.com/s?wd=<?=urlencode($wd)?>" target="_blank">进入百度搜索</a></td>
<td>总共<?=$Page[1]?>条信息</td>
</tr>
<?php
$b=explode("<item>",$r1[1]);
for($i=1;$i<sizeof($b);$i++){
$b_str = $b[$i];
eregi("<title>(.*)</title>",$b_str,$title);
eregi("<link>(.*)</link>",$b_str,$link);
eregi("<description>(.*)</description>",$b_str,$description);
eregi("<Domain>(.*)</Domain>",$b_str,$Domain);
eregi("<Date>(.*)</Date>",$b_str,$Date);?>
<tr>
<td colspan="3" <?php
if($i%2==0){
?>bgcolor="#F7F7F7"<?
}
?>>信息:<a href="<?=$link[1]?>" target="_blank"><?=$title[1]?></a><br />
介绍:<?=$description[1]?><br />
更新:<?=$Date[1]?><br />
连接缩略:<?php
if($Domain[1]!=""){
?>
<a href="<?=$link[1]?>" target="_blank">http://<?=$Domain[1]?></a>
<?php
}else{
?>
<a href="<?=$link[1]?>" target="_blank"><?=$link[1]?></a>
<?php
}
?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="3"><?=$pn1[1]?></td>
</tr>
</table>
</body>
</html>
<?php
if($_GET['wd']!=""){
$wd = $_GET['wd'];
}else{
$wd = "%BE%DB%B5%E3%C9%CC%CE%F1%CD%F8";
}
if(mb_detect_encoding($wd)=="UTF-8"){
$wd = iconv("utf-8","gb2312",$wd);
}
$pn = $_GET[pn];$url = "http://baidu.hljsql.com/?wd=".urlencode($wd)."&pn=".$pn;
$r = file($url);
$r = implode('', $r);
$r = iconv("","utf-8",$r);
eregi("<!--title_(.*)_/title-->",$r,$title);
eregi("<!--接口开始-->(.*)<!--接口结束-->",$r,$r1);
eregi("<pn1>(.*)</pn1>",$r,$pn1);
eregi("<Page>(.*)</Page>",$r,$Page);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="<?=$title[1]?>-<?=$_GET['pn']?>">
<meta name="Description" content="<?=$title[1]?>-<?=$_GET['pn']?>">
<title><?=$title[1]?>-<?=$_GET['pn']?></title>
<style>
em{ color:#F00; }
a{ text-decoration:none; }
</style>
</head>
<body><form action="?" method="get"><input name="wd" type="text" id="wd" value="<?=$title[1];?>" /><input name="搜索" type="submit" id="搜索" value="搜索" />
</form>
<table width="100%" border="1">
<tr>
<td>关键词:<?=$title[1];?></td>
<td><a href="http://www.baidu.com/s?wd=<?=urlencode($wd)?>" target="_blank">进入百度搜索</a></td>
<td>总共<?=$Page[1]?>条信息</td>
</tr>
<?php
$b=explode("<item>",$r1[1]);
for($i=1;$i<sizeof($b);$i++){
$b_str = $b[$i];
eregi("<title>(.*)</title>",$b_str,$title);
eregi("<link>(.*)</link>",$b_str,$link);
eregi("<description>(.*)</description>",$b_str,$description);
eregi("<Domain>(.*)</Domain>",$b_str,$Domain);
eregi("<Date>(.*)</Date>",$b_str,$Date);?>
<tr>
<td colspan="3" <?php
if($i%2==0){
?>bgcolor="#F7F7F7"<?
}
?>>信息:<a href="<?=$link[1]?>" target="_blank"><?=$title[1]?></a><br />
介绍:<?=$description[1]?><br />
更新:<?=$Date[1]?><br />
连接缩略:<?php
if($Domain[1]!=""){
?>
<a href="<?=$link[1]?>" target="_blank">http://<?=$Domain[1]?></a>
<?php
}else{
?>
<a href="<?=$link[1]?>" target="_blank"><?=$link[1]?></a>
<?php
}
?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="3"><?=$pn1[1]?></td>
</tr>
</table>
</body>
</html>
解决方案 »
- 用phpeclipse开发过的工程再用zend studio就不能显示函数的出处?
- php实现tab页签内的分页
- 如何检测某个页面已经在浏览器中打开
- 继承
- 正则送分问题?
- 分析一VBB论坛的SQL语句...
- 也问关于mysql_num_rows()一个奇怪的问题,附一个上传是出现的问题
- 在xp下启动Apache2.0.40会报出错误:the requested operation has failed.这是什么问题阿。谢谢高手指点
- 如何用php写一个事件对话框?
- mysql中有函数取自动生成的字段值,SQlserver中怎么取呢?
- php建站的数据数是怎么回事
- php正则替换怎样把 href=http://24356>替换成href=http://24356.xxx.com>
<?php
function display(){
printf("hello");
}?>
<html>
<head>
<title>
</title>
</head>
<body>
<?php
display();
?></body>
</html>
//a.php $a=10; function funa($p)
{
echo $p;
}//b.php
include('a.php');
$echo $a;//输出10funa($a);
这个可以,只要PHP代码用<?php ?>括起来就行