我想最简单的是通过UA来区分,但是我发现抓取不同手机时,有的可以获得UA,有的就不能获得,还有其他什么方式可以判断手机型号吗?WAP程序的
以下是我获得的请求头信息,后面附获取程序
多普达S1 IE:
accept:text/html; text/vnd.sun.j2me.app-descriptor, */*
accept-language:zh-cn
ua-os:Windows CE (Pocket PC) - Version 5.2
ua-color:color16
x-wap-profile:"http://www.htcmms.com.tw/gen/elfin-1.1.xml"
ua-voice:TRUE
ua-pixels:240x320
ua-cpu:x86
accept-encoding:gzip, deflate
user-agent:dopod S1_CMCC/5.2.1235/WAP2.0 Profile/MIDP2.0 Configuration/CLDC1.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)
host:123.122.99.136
connection:Keep-Alive
多普达S1 UCWeb
host:123.122.99.136
accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, dn/807993233-aa6ec33c,ss/220x268
accept-encoding:gzip,deflate
accept-language:zh-cn
accept-charset:x-gbk,utf-8;q=0.7,*;q=0.7
cache-control:max-age=259200
connection:keep-alive
摩托罗拉L7
host:123.122.99.136
accept:application/vnd.wap.wmlc, application/vnd.wap.wbxml, application/vnd.wap.wmlscriptc, text/wml, text/vnd.wap.wml, text/html, text/css, application/xhtml+xml, application/vnd.wap.xhtml+xml, application/vnd.wap.multipart.related, application/vnd.wap.multipart.mixed, multipart/mixed, application/vnd.wap.sic, application/vnd.phonecom.mmc-wbxml, application/vnd.oma.dd+xml, application/motorola-mmstemplate, image/gif, image/bmp, image/vnd.wap.wbmp, image/png, image/jpeg, image/ems.userdefined.picture, image/ems.userdefined.animation, image/ems.predefined.animation, audio/imelody, audio/mid, audio/midi, audio/x-midi, audio/mp3, audio/mpeg, audio/mpeg3, audio/mpg, audio/x-mp3, audio/x-mpeg, audio/x-mpeg3, audio/x-mpg, audio/x-wav, audio/wav, audio/amr, audio/mp4, audio/3gpp, audio/m4a, audio/x-m4a, video/mp4, video/3gpp, application/vnd.oma.drm.message, application/vnd.oma.drm.rights+xml, application/vnd.oma.drm.content, application/vnd.oma.drm.rights+wbxml, text/x-vcard, text/x-vcalendar, text/uri-list, text/vnd.sun.j2me.app-descriptor, application/java-archive, application/octet-stream, application/vnd.wap.mms-message, text/vnd.wap.si, text/plain, text/vnd.wap.wmlscript
accept-application:2,4
accept-charset:UTF-8
accept-language:zh
via:WTP/1.1 BJBJ-P-GW13-WAP.bj.monternet.com (Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)
x-forwarded-for:10.148.102.233
x-source-id:BJGGSN05BMT-CSK
x-nokia-connection_mode:CMODE
x-up-bear-type:GPRS/ EDGE
x-nokia-gateway-id:NWG/4.1/Build4.1.04
x-wap-profile:http://motorola.handango.com/phoneconfig/l7/Profile/l7.rdf
connection:close
诺基亚E71
host:123.122.99.136
accept:text/html, text/css, multipart/mixed, application/java-archive, application/java, application/x-java-archive, text/vnd.sun.j2me.app-descriptor, application/vnd.oma.drm.message, application/vnd.oma.drm.content, application/vnd.oma.dd+xml, application/vnd.oma.drm.rights+xml, application/vnd.oma.drm.rights+wbxml, application/x-nokia-widget, */*, text/x-vcard, text/x-vcalendar, image/gif, image/vnd.wap.wbmp
accept-charset:iso-8859-1, utf-8; q=0.7, *; q=0.7
accept-encoding:gzip, deflate, x-gzip, identity; q=0.9
accept-language:zh-cn, zh;q=1.0,en;q=0.5
cookie:jid=L1SnvFqLrq!495235121
cookie2:$Version=1
content-length:0
via:WTP/1.1 BJBJ-PS-WAP3-GW15.bj3.monternet.com (Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)
x-forwarded-for:10.188.253.27
x-source-id:BJGGSN53BNK
x-nokia-connection_mode:TCP
x-up-bear-type:GPRS/ EDGE
x-nokia-gateway-id:NWG/4.1/Build4.1.04
connection:close
山寨
connection:Keep-Alive
host:123.122.99.136
accept:application/xhtml+xml; profile=http://www.wapforum.org/xhtml, application/vnd.wap.xhtml+xml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, text/vnd.wap.wml, image/vnd.wap.wbmp, image/gif, image/bmp, image/png, audio/amr, audio/imelody, audio/midi, audio/wav, application/vnd.wap.wtls-ca-certificate, application/x-x509-ca-cert, application/vnd.wap.hashed-certificate, application/vnd.wap.signed-certificate, */*, text/html
accept-charset:utf-8, utf-16, iso-8859-1, iso-10646-ucs-2, GB2312, windows-1252, us-ascii
accept-language:zh-tw, zh-cn, en
via:HTTP/1.1 BJ-WAP1-SV03 (infoX-WISG, Huawei Technologies)
x-forwarded-for:10.7.5.136
x-up-bear-type:GPRS
user-agent:MAUI_WAP_Browser
黑莓
host:123.122.99.136
connection:keep-alive
user-agent:BlackBerry8820/4.5.0.124 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/155
accept:text/html,application/xhtml+xml,application/vnd.wap.xhtml+xml,application/vnd.wap.wmlc;q=0.9,application/vnd.wap.wmlscriptc;q=0.7,text/vnd.wap.wml;q=0.7,text/vnd.sun.j2me.app-descriptor,*/*;q=0.5
accept-charset:ISO-8859-1,UTF-8,US-ASCII,UTF-16BE,windows-1252,UTF-16LE,Big5-HKSCS,Big5,GB2312,windows-1250
accept-language:zh-CN,zh;q=0.5
accept-encoding:gzip,deflate
x-wap-profile:"http://www.blackberry.net/go/mobile/profiles/uaprof/8820/4.5.0.rdf"
Java code
Enumeration names = request.getHeaderNames();
while(names.hasMoreElements()){
String name = (String)names.nextElement();
out.println("<b>" + name + ":</b>" + request.getHeader(name) + "<br />");
System.out.println(name + ":" + request.getHeader(name) + "");
}
以下是我获得的请求头信息,后面附获取程序
多普达S1 IE:
accept:text/html; text/vnd.sun.j2me.app-descriptor, */*
accept-language:zh-cn
ua-os:Windows CE (Pocket PC) - Version 5.2
ua-color:color16
x-wap-profile:"http://www.htcmms.com.tw/gen/elfin-1.1.xml"
ua-voice:TRUE
ua-pixels:240x320
ua-cpu:x86
accept-encoding:gzip, deflate
user-agent:dopod S1_CMCC/5.2.1235/WAP2.0 Profile/MIDP2.0 Configuration/CLDC1.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)
host:123.122.99.136
connection:Keep-Alive
多普达S1 UCWeb
host:123.122.99.136
accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, dn/807993233-aa6ec33c,ss/220x268
accept-encoding:gzip,deflate
accept-language:zh-cn
accept-charset:x-gbk,utf-8;q=0.7,*;q=0.7
cache-control:max-age=259200
connection:keep-alive
摩托罗拉L7
host:123.122.99.136
accept:application/vnd.wap.wmlc, application/vnd.wap.wbxml, application/vnd.wap.wmlscriptc, text/wml, text/vnd.wap.wml, text/html, text/css, application/xhtml+xml, application/vnd.wap.xhtml+xml, application/vnd.wap.multipart.related, application/vnd.wap.multipart.mixed, multipart/mixed, application/vnd.wap.sic, application/vnd.phonecom.mmc-wbxml, application/vnd.oma.dd+xml, application/motorola-mmstemplate, image/gif, image/bmp, image/vnd.wap.wbmp, image/png, image/jpeg, image/ems.userdefined.picture, image/ems.userdefined.animation, image/ems.predefined.animation, audio/imelody, audio/mid, audio/midi, audio/x-midi, audio/mp3, audio/mpeg, audio/mpeg3, audio/mpg, audio/x-mp3, audio/x-mpeg, audio/x-mpeg3, audio/x-mpg, audio/x-wav, audio/wav, audio/amr, audio/mp4, audio/3gpp, audio/m4a, audio/x-m4a, video/mp4, video/3gpp, application/vnd.oma.drm.message, application/vnd.oma.drm.rights+xml, application/vnd.oma.drm.content, application/vnd.oma.drm.rights+wbxml, text/x-vcard, text/x-vcalendar, text/uri-list, text/vnd.sun.j2me.app-descriptor, application/java-archive, application/octet-stream, application/vnd.wap.mms-message, text/vnd.wap.si, text/plain, text/vnd.wap.wmlscript
accept-application:2,4
accept-charset:UTF-8
accept-language:zh
via:WTP/1.1 BJBJ-P-GW13-WAP.bj.monternet.com (Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)
x-forwarded-for:10.148.102.233
x-source-id:BJGGSN05BMT-CSK
x-nokia-connection_mode:CMODE
x-up-bear-type:GPRS/ EDGE
x-nokia-gateway-id:NWG/4.1/Build4.1.04
x-wap-profile:http://motorola.handango.com/phoneconfig/l7/Profile/l7.rdf
connection:close
诺基亚E71
host:123.122.99.136
accept:text/html, text/css, multipart/mixed, application/java-archive, application/java, application/x-java-archive, text/vnd.sun.j2me.app-descriptor, application/vnd.oma.drm.message, application/vnd.oma.drm.content, application/vnd.oma.dd+xml, application/vnd.oma.drm.rights+xml, application/vnd.oma.drm.rights+wbxml, application/x-nokia-widget, */*, text/x-vcard, text/x-vcalendar, image/gif, image/vnd.wap.wbmp
accept-charset:iso-8859-1, utf-8; q=0.7, *; q=0.7
accept-encoding:gzip, deflate, x-gzip, identity; q=0.9
accept-language:zh-cn, zh;q=1.0,en;q=0.5
cookie:jid=L1SnvFqLrq!495235121
cookie2:$Version=1
content-length:0
via:WTP/1.1 BJBJ-PS-WAP3-GW15.bj3.monternet.com (Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)
x-forwarded-for:10.188.253.27
x-source-id:BJGGSN53BNK
x-nokia-connection_mode:TCP
x-up-bear-type:GPRS/ EDGE
x-nokia-gateway-id:NWG/4.1/Build4.1.04
connection:close
山寨
connection:Keep-Alive
host:123.122.99.136
accept:application/xhtml+xml; profile=http://www.wapforum.org/xhtml, application/vnd.wap.xhtml+xml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, text/vnd.wap.wml, image/vnd.wap.wbmp, image/gif, image/bmp, image/png, audio/amr, audio/imelody, audio/midi, audio/wav, application/vnd.wap.wtls-ca-certificate, application/x-x509-ca-cert, application/vnd.wap.hashed-certificate, application/vnd.wap.signed-certificate, */*, text/html
accept-charset:utf-8, utf-16, iso-8859-1, iso-10646-ucs-2, GB2312, windows-1252, us-ascii
accept-language:zh-tw, zh-cn, en
via:HTTP/1.1 BJ-WAP1-SV03 (infoX-WISG, Huawei Technologies)
x-forwarded-for:10.7.5.136
x-up-bear-type:GPRS
user-agent:MAUI_WAP_Browser
黑莓
host:123.122.99.136
connection:keep-alive
user-agent:BlackBerry8820/4.5.0.124 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/155
accept:text/html,application/xhtml+xml,application/vnd.wap.xhtml+xml,application/vnd.wap.wmlc;q=0.9,application/vnd.wap.wmlscriptc;q=0.7,text/vnd.wap.wml;q=0.7,text/vnd.sun.j2me.app-descriptor,*/*;q=0.5
accept-charset:ISO-8859-1,UTF-8,US-ASCII,UTF-16BE,windows-1252,UTF-16LE,Big5-HKSCS,Big5,GB2312,windows-1250
accept-language:zh-CN,zh;q=0.5
accept-encoding:gzip,deflate
x-wap-profile:"http://www.blackberry.net/go/mobile/profiles/uaprof/8820/4.5.0.rdf"
Java code
Enumeration names = request.getHeaderNames();
while(names.hasMoreElements()){
String name = (String)names.nextElement();
out.println("<b>" + name + ":</b>" + request.getHeader(name) + "<br />");
System.out.println(name + ":" + request.getHeader(name) + "");
}