想搞个奥运奖牌榜小偷,要如何搞? 很简单的,远程打开url,然后读取,折分就可以了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 file("http://www.sohu.com")可以抓取网页 我想这样做,将抽取的页面变为XML形式,这样在XML中抽取数据就方便了,XML中如何用XML呀? 下面这个是偷取新浪天气预报的参考一下吧:============================<?if (function_exists('set_time_limit') == 1 && @ini_get('safe_mode') == 0) { @set_time_limit(1000);}@ob_implicit_flush();@clearstatcache();?><html><head><meta http-equiv="Content-type" content="text/html; charset=gb2312"><title>天气预报</title><style>td,p,li,select,input {font-size:12px}.l15{line-height:150%;}IMG{border:0px}.img01{border:1 solid #000000;}.f14{font-size:14px;}A:hover {color: ff0000;}A.title1,A.title1:hover {font-size:17px;font-family:arial;font-weight:bold;text-decoration:none;color:#000000;}A.title2:link,A.title2:visited {text-decoration:none;color:#000000;}A.title2:active,A.title2:hover {text-decoration:none;color:#ff0000;}A.sinatail:link,A.sinatail:visited {text-decoration:underline;color:#0000ff;font-size:12px}A.sinatail:active,A.sinatail:hover {text-decoration:underline;color:#ff0000;font-size:12px}.h3 {font-size:7px;color:#FFBD00}A.a01:link,A.a01:visited {text-decoration:none;color:#07015B;}A.a01:active,A.a01:hover {text-decoration:none;color:#ff0000;}A.a02:link,A.a02:visited {color:#808080;}A.a02:active,A.a02:hover {color:#ff0000;}A.a03:link,A.a03:visited {text-decoration:none;color:#808080;}A.a03:active,A.a03:hover {text-decoration:none;color:#ff0000;}.td01{border-right:1 solid #ffffff;border-bottom:1 solid #ffffff}</style></head><body bgcolor=#ffffff topmargin=5 marginheight=5 leftmargin=5 marginwidth=5><center><?$action=$_GET[action];if(!$action)$action="index";$url="http://weather.news.sina.com.cn/".$action.".html";$ob=fopen($url,"r") ; // $str = @fread ($ob, 49306);$str='';$temp='';while(!feof($ob)){ $temp=fgets($ob,1024); $str=$str.$temp; }fclose($ob);$a=explode("<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>",$str);if(strstr($a[3],'更新')){$s1=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[4];$a[5]=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[5]; $count=count($a); for($i=6;$i<$count;$i++){ $a[5]=$a[5]."<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[$i]; }$a1=explode("<!-- 访问Log统计测试 : begin -->",$a[5]);$str=$s1.$a1[0];}else{$s1=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[3];$a[4]=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[4]; $count=count($a); for($i=5;$i<$count;$i++){ $a[4]=$a[4]."<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[$i]; }$a1=explode("<!-- 访问Log统计测试 : begin -->",$a[4]);$str=$s1.$a1[0];}$str=str_replace("href=","href=?action=",$str);$str=str_replace(".html","",$str);echo $str; ?></center></body></html> 其中的action请初始化为:index48 晕了 http://weather.news.sina.com.cn/index48.html 这个数据几个月没更新了 http://www.yubeinet.com/bbs/wdbread.php?forumid=15&filename=f_354&fpage=3 这个贴怎么还在阿作 者: mdot () 等 级: 信 誉 值: 87 难怪 占用内存过高,请高手过目。 Catchable fatal error: Object of class dUser could not be converted to string in on line 16 急求php代码 请做过大型PHP网站的高手赐教! php 样式风格变样 php难题。。。高手帮帮忙 求求大家帮我这新手解决一个疑问 现在有多少人自已开发系统做站的? 做PHP有前途和钱途么? php 开发工具使用问题 哈哈,今天下午4点就下班,4号上班,散分哈,大家新年快乐,接分痛快 产品编号和订单编号问题
XML中如何用XML呀?
参考一下吧:
============================
<?
if (function_exists('set_time_limit') == 1 && @ini_get('safe_mode') == 0) {
@set_time_limit(1000);
}
@ob_implicit_flush();
@clearstatcache();
?>
<html><head>
<meta http-equiv="Content-type" content="text/html; charset=gb2312">
<title>天气预报</title>
<style>
td,p,li,select,input {font-size:12px}
.l15{line-height:150%;}
IMG{border:0px}
.img01{border:1 solid #000000;}
.f14{font-size:14px;}
A:hover {color: ff0000;}
A.title1,A.title1:hover {font-size:17px;font-family:arial;font-weight:bold;text-decoration:none;color:#000000;}
A.title2:link,A.title2:visited {text-decoration:none;color:#000000;}
A.title2:active,A.title2:hover {text-decoration:none;color:#ff0000;}
A.sinatail:link,A.sinatail:visited {text-decoration:underline;color:#0000ff;font-size:12px}
A.sinatail:active,A.sinatail:hover {text-decoration:underline;color:#ff0000;font-size:12px}.h3 {font-size:7px;color:#FFBD00}A.a01:link,A.a01:visited {text-decoration:none;color:#07015B;}
A.a01:active,A.a01:hover {text-decoration:none;color:#ff0000;}A.a02:link,A.a02:visited {color:#808080;}
A.a02:active,A.a02:hover {color:#ff0000;}A.a03:link,A.a03:visited {text-decoration:none;color:#808080;}
A.a03:active,A.a03:hover {text-decoration:none;color:#ff0000;}.td01{border-right:1 solid #ffffff;border-bottom:1 solid #ffffff}
</style>
</head>
<body bgcolor=#ffffff topmargin=5 marginheight=5 leftmargin=5 marginwidth=5>
<center>
<?
$action=$_GET[action];
if(!$action)$action="index";
$url="http://weather.news.sina.com.cn/".$action.".html";
$ob=fopen($url,"r") ;
// $str = @fread ($ob, 49306);
$str='';
$temp='';
while(!feof($ob)){
$temp=fgets($ob,1024);
$str=$str.$temp;
}
fclose($ob);
$a=explode("<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>",$str);
if(strstr($a[3],'更新')){$s1=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[4];
$a[5]=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[5];
$count=count($a);
for($i=6;$i<$count;$i++){
$a[5]=$a[5]."<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[$i];
}
$a1=explode("<!-- 访问Log统计测试 : begin -->",$a[5]);
$str=$s1.$a1[0];
}else{
$s1=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[3];
$a[4]=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[4];
$count=count($a);
for($i=5;$i<$count;$i++){
$a[4]=$a[4]."<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[$i];
}
$a1=explode("<!-- 访问Log统计测试 : begin -->",$a[4]);
$str=$s1.$a1[0];
}
$str=str_replace("href=","href=?action=",$str);
$str=str_replace(".html","",$str);
echo $str;
?>
</center>
</body>
</html>
等 级:
信 誉 值: 87
难怪