已掉线,重新登录

首页 > 绿虎论坛 > 杂类 > 超级灌水 (发帖)

标题: PHP网页截取助手源码

作者: @Ta

时间: 2011-10-05

点击: 1281

用手机编程,功能太多经常出错,遂精简很多…希望虎哥提点修正建议,下面是http://ai.me.ly/app/?read=substr源码(经UBB解析直接从缓存中拿出来的,小小修改一下就可用http://ai.me.ly/file/?/pagecut.gz改.gz为.php)
<?php
error_reporting('0');
$START_TIME=microtime();
echo '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml" charset="UTF8"/>
<title>网页截取助手 Min.</title>
</head>
<body>
';
if(($url=preg_replace('#^(http://)#i','',$_POST['url']))!=FALSE){
$url='http://'.$url;
$FileOpen=fopen($url,'rb');
while(!feof($FileOpen)){
$nr.=fgets($FileOpen,999999);
}
$nr=iconv($_POST['encode'],'UTF-8',$nr);
$nr=strip_tags(preg_replace('#(
|
|
|<br/ >|
|<hr>|<hr/>|<hr >|<hr />)#i',$_POST['br'],preg_replace('#</div>#i','</div>
',$nr)));
function 字串截取($内容,$开始,$结束){
$内容=substr($内容,strpos($内容,$开始));
$内容=substr($内容,0,strpos($内容,$结束));
return $内容.$结束;
}
$nr=字串截取($nr,$_POST['start'],$_POST['end']);
echo '执行结果:
<input type="text" name="result" value="'.htmlspecialchars($nr).'"/><hr/>';
}
echo '
<form accept-charset="utf-8" action="?" method="post">
<input type="hidden" name="read" value="substr"/>
目标网页URL:
<input type="text" name="url" value="http://"/>
网页编码:
<select name="encode"><option value="utf-8">UTF-8</option><option value="gb2312">GB2312</option></select>
截取[开始,可留空]:
<input type="text" name="start" value=""/>
截取[结束,可留空]:
<input type="text" name="end" value=""/>
换行匹配为:
<input type="text" name="br" value="'.chr("91").'br'.chr("93").'"/>
<input type="submit" value="Ok!"/>
</form><hr/>';
$END_TIME=microtime();
$runtime=$END_TIME - $START_TIME;
printf("执行时间: %.6f Sec.",$runtime);
echo '</body></html>';
?>

[隐藏样式|查看源码]


『回复列表(3|隐藏机器人聊天)』

1. 有些东西系统隐藏了,有些给解析了,Hu60程序还需加强!!
(/@Ta/2011-10-05 00:17//)

2. 压浏可以这样
(/@Ta/2011-10-05 00:17//)

3. 以上源码不可以
(/@Ta/2011-10-06 18:52//)

回复需要登录

9月15日 05:07 星期一

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1