1.自动识别WEB和WAP访客的信息p信息源码
自动识别WEB和WAP访客的源码
既然要利用已经存在的为HTML浏览器编写的代码,就需要知道请求是发布从HTML浏览器还是从WML浏览器过来的。同样地,网站如果想重新引导的源码小说分销源码二开HTML浏览器直接到相应的HTML文档上,WML浏览器到WML页面上,布网以下的站源好彩票源码PHP代码就可以做到这些。
// Because this 信息p信息script sends out HTTP header information,
// the first characters in the file must be the ? PHP tag.
// relative URL to your HTML file
$htmlredirect = "/html/my_htmlpage.html";
// ABSOLUTE URL to your WML file
$wmlredirect = "/wml/my_wmldeck.wml";
if(strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.WML") 0)
{ // Check whether the browser/gateway says it accepts WML.
$br = "WML";
}
else {
$browser=substr(trim($HTTP_USER_AGENT),0,4);
if($browser=="Noki" || // Nokia phones and emulators
$browser=="Eric" || // Ericsson WAP phones and emulators
$browser=="WapI" || // Ericsson WapIDE 2.0
$browser=="MC" || // Ericsson MC
$browser=="AUR " || // Ericsson R
$browser=="R" || // Ericsson R
$browser=="UP.B" || // UP.Browser
$browser=="WinW" || // WinWAP browser
$browser=="UPG1" || // UP.SDK 4.0
$browser=="upsi" || // another kind of UP.Browser
$browser=="QWAP" || // unknown QWAPPER browser
$browser=="Jigs" || // unknown JigSaw browser
$browser=="Java" || // unknown Java based browser
$browser=="Alca" || // unknown Alcatel-BE3 browser (UP based?)
$browser=="MITS" || // unknown Mitsubishi browser
$browser=="MOT-" || // unknown browser (UP based?)
$browser=="My S" ||// unknown Ericsson devkit browser ?
$browser=="WAPJ" || // Virtual WAPJAG www.wapjag.de
$browser=="fetc" || // fetchpage.cgi Perl script from www.wapcab.de
$browser=="ALAV" || // yet another unknown UP based browser ?
$browser=="Wapa") // another unknown browser (Web based "Wapalyzer"?)
{
$br = "WML";
}
else {
$br = "HTML";
}
}
if($br == "WML") {
// Force the browser to load the WML file instead
header(" Moved Temporarily");
header("Location: ".$wmlredirect);
exit;
}
else {
// Force the browser to load the HTML file instead
header(" Moved Temporarily");
header("Location: ".$htmlredirect);
exit;
}
?
这个判断是在服务端完成的, PHP代码将首先查看网关是发布否接收text/vnd.wap.vml MIME类型。如果不是网站,将检测前面的源码字符,查看是布网否为WML浏览器。如果不符合,站源那么就假设为HTML浏览器。信息p信息php聊天群源码如果有新的发布WML浏览器,那么ID字符串也要增加。网站
这个代码基于Robert Whitinger(robert@wapsight.com)的android 6.0源码root代码,使用了Don Amaro(donamaro.concepcion@nl.unisys.com)提供的列表。
注意:由于只需要四个字符串就可以辨别,因此例如:"WapIDE-SDK/2.0;(Rs(Arial))" 可以使用“WapI”来代替是聆听听书源码可行的做法,也是足够的。
同样的功能也可以通过ASP来解决。先判断请求的是“/index.wml” 或者 “/index.html” 和所需要的MIME类型。另外以下的脚本辨别的方式和上面不一样。另外还需要网关告诉服务器它能接收的text/vnd.wap.wml MIME类型。该例子如下所示:
%
Response.Buffer = TRUE
Dim IsWap
httpAccept = LCase(Request.ServerVariables("HTTP_ACCEPT"))
if Instr(httpAccept,"wap") then
IsWap=1
Else Response.Redirect "/index.html" : Response.Flush : Response.End
End if
%
%Response.ContentType = "text/vnd.wap.wml"%?xml version="1.0"?
%Response.Flush%
!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml"
wml
card id="redirect"
onevent type="onenterforward"
go href="/index.wml"/
/onevent
p
a href="/index.wml"enter/a
/p
/card
/wml
%Response.Flush:Response.End%
2024-12-27 14:29
2024-12-27 14:19
2024-12-27 14:18
2024-12-27 13:57
2024-12-27 13:23
2024-12-27 12:47
2024-12-27 12:05
2024-12-27 12:05