html、wap、php,HTML转WAP-自动转换你的网站成WAP手机网站的PHP代码,扩展分享,SpeedPHP快速开发框架,中文PHP框架 - Powered by Discuz!...

@ob_clean();

if( isset($_GET['src']) ){

$src = str_replace('&','&', $_GET['src']);

if( 'http://' == substr($src, 0, 7 ) )header("location:{$src}");

$request = "http://".$_SERVER ['HTTP_HOST'] .'/' .$src;

}else{

$request = "http://".$_SERVER ['HTTP_HOST'];

}

$content = file_get_contents($request);

header("Content-type: text/vnd.wap.wml");

echo '<?xml version="1.0" encoding="UTF-8"?>       "http://www.wapforum.org/DTD/wml_1.1.xml">';

preg_match_all( "/\

(.*?)\/i", $content, $title );

echo "

";

$patterns = array(

'/
/i',

'//i',

'/(.*?)/si',

'/(.*?)/si',

'/(.*?)/si',

'/(.*?)/ie',

'//ie',

'/\ \;/i',

'/\ /i',

);

$replacements = array(

"\n",

"\n",

'',

'',

'',

"''.stripslashes('\\4').''",

"'%5C%22%5C%5C2%5C%22'",

" ",

" ",

);

$content = preg_replace($patterns, $replacements, $content);

$content = strip_tags($content,"");

$content = html_entity_decode($content, ENT_QUOTES, 'UTF-8');

$content = preg_replace("/\&\#.*?\;/i", "", $content);

$content = str_replace(array(',"\r\n"), array(', "\n"), $content);

$content = explode("\n", $content);

for ($i = 0; $i < count($content); $i++) {

$content[$i] = trim($content[$i]);

if (str_replace(" ", "", $content[$i]) == "") $content[$i] = "";

}

$content = str_replace("

".implode("

\n

", $content)."

\n");

echo str_replace(array('

','

'),'',$content);

echo '

';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值