Friday, September 05, 2008

测试手机的 User-Agent

由于最近工作中需要得到一些手机的 User-Agent 以及 X-Wap-Profile 两个 HTTP 头的值,于是写了个简单的 PHP 程序,检测 HTTP 头,输出到 Response,然后放到网站上,让手机用 WAP 浏览器打开查看。

开始这个程序只是简单的输出纯文本,结果是 NOKIA、Sony Ericsson 以及 Samsung 手机都能正确读出,而 Motorola 却不行(实际测试过程中用的是 Motorola RAZR V3i),仅显示白页。

后来把程序改成输出标准 WML 页面,HTTP 头的 Content-Type 设置成 application/vnd.wap.xhtml+xml,NOKIA、Sony Ericsson 以及 Samsung 仍然能够正确显示而 Motorola 还是不合作。

最后找到答案,Content-Type 要设置成“text/vnd.wap.wml”,这下 Motorola 终于老实了…… 可是结果中只有 User-Agent,没有 X-Wap-Profile。

另外,在用中国移动的 SIM 卡测试的时候,发现 HTTP 请求中并没有 User-Agent 和 X-Wap-Profile 这两个头,而有个奇怪的
VIA: HTTP/1.1 SCCD-PS-WAP-GW02 (infoX-WISG, Huawei Technologies)
开始以为是手机的问题,但看到“Huawei”字样,觉得很蹊跷,后来换成 Orange France 的 SIM 卡,则一切正常了。

看来拦截 HTTP 请求是中国运营商的“优良传统”啊!

Update 2009/08/03:

最近发现中国移动这个问题只存在于 cmwap,用 cmnet 则正常。

13 comments:

Maple said...

太有才了,以一个局外人的角度来看您太有才了,非常感谢

Black-Xstar said...

万恶的cmwap啊……

Anonymous said...

Wonderful blog! Do you have any recommendations for aspiring writers?

I'm planning to start my own site soon but I'm a little
lost on everything. Would you advise starting with a free platform like Wordpress or
go for a paid option? There are so many choices out there that I'm completely overwhelmed ..
Any recommendations? Bless you!

My web site Chemist Direct Healthcare Products

jim kill said...

louis vuitton handbags
burberry scarf
ray ban sunglasses outlet
michael kors
cheap uggs
cheap oakleys
abercrombie fitch
ugg boots
tory burch flats
lv outlet
tods outlet
michael kors handbags
michael kors outlet online
ghd flat iron
coach outlet
coach factory online
prada handbags
lebron 11
canada goose jacket
ray ban outlet
christian louboutin
chanel handbags
coach outlet
polo outlet
michael kors outlet online
ray ban canada
coach factory outlet
20150311huangqihang

mao yun said...

8
timberland boots
nhl jerseys
ed hardy t-shirts
swarovski outlet
abercrombie
longchamp sale
hollister shirts
timberland outlet
coach factory outlet
iphone 6 cases
salvatore ferragamo
swarovski crystal
ray ban uk
abercrombie
louis vuitton handbags
herve leger sale
louis vuitton outlet
kate spade outlet
lebron 10,lebron 11,lebron 12
michael kors outlet
tod's shoes
jordan shoes
asics shoes
michael kors outlet
mont blanc
tory burch handbags
nfl jerseys wholesale
kobe 9 elite
converse shoes
prada handbags
mcm handbags
cheap nba jerseys
louis vuitton outlet uk
ray ban
christian louboutin outlet
air jordan concord
ray ban outlet
coach outlet online
mont blanc pens
cheap ray ban sunglasses
20150330maoqiuyun

oakleyses said...

oakley sunglasses, longchamp outlet, ugg boots, chanel handbags, nike air max, longchamp, christian louboutin outlet, michael kors outlet, oakley sunglasses, tiffany and co, replica watches, tory burch outlet, nike air max, ray ban sunglasses, michael kors outlet, louboutin shoes, jordan shoes, louis vuitton outlet, louis vuitton, ray ban sunglasses, longchamp outlet, polo ralph lauren outlet, replica watches, kate spade outlet, oakley sunglasses, polo ralph lauren outlet, cheap oakley sunglasses, ugg boots, nike free, tiffany jewelry, michael kors outlet, uggs on sale, louis vuitton outlet, michael kors, oakley sunglasses, louboutin, louis vuitton, michael kors outlet, ray ban sunglasses, prada handbags, louis vuitton, burberry, burberry outlet online, gucci outlet

oakleyses said...

nike blazer, michael kors, nike free run uk, nike air max, true religion jeans, true religion jeans, air jordan pas cher, nike air max, ralph lauren uk, timberland, air max, nike roshe, tn pas cher, louboutin pas cher, true religion outlet, vans pas cher, coach outlet, hermes, ralph lauren pas cher, nike free, coach purses, michael kors, oakley pas cher, mulberry, hollister pas cher, lacoste pas cher, new balance pas cher, ray ban pas cher, vanessa bruno, burberry, hollister, michael kors, kate spade handbags, coach outlet, abercrombie and fitch, lululemon, coach factory outlet, nike roshe run, north face, nike air max, ray ban uk, michael kors, true religion jeans, converse pas cher, north face, air force, hogan, sac longchamp, longchamp pas cher, sac guess

oakleyses said...

ferragamo shoes, iphone 6s plus cases, babyliss, longchamp, reebok shoes, nike trainers, asics running shoes, oakley, iphone 5s cases, celine handbags, hollister, nfl jerseys, jimmy choo shoes, birkin bag, iphone 6s cases, iphone cases, mcm handbags, bottega veneta, giuseppe zanotti, iphone 6 plus cases, abercrombie and fitch, p90x workout, beats by dre, herve leger, north face outlet, instyler, louboutin, soccer jerseys, lululemon, nike roshe, s5 cases, timberland boots, mac cosmetics, soccer shoes, valentino shoes, insanity workout, vans shoes, hollister, ralph lauren, wedding dresses, ipad cases, chi flat iron, north face outlet, iphone 6 cases, nike air max, ghd, mont blanc, baseball bats, new balance, nike huarache

oakleyses said...

ugg pas cher, vans, moncler, moncler, canada goose, louis vuitton, ugg boots uk, canada goose, toms shoes, doudoune canada goose, moncler, louis vuitton, louis vuitton, ugg australia, juicy couture outlet, moncler, supra shoes, doke gabbana outlet, gucci, karen millen, moncler outlet, hollister, moncler, hollister, canada goose, louis vuitton, ray ban, marc jacobs, pandora jewelry, michael kors outlet online, moncler, swarovski crystal, pandora jewelry, wedding dresses, thomas sabo, moncler, bottes ugg, sac louis vuitton pas cher, nike air max, barbour, barbour jackets, pandora charms, canada goose outlet, canada goose uk, michael kors outlet, converse outlet, links of london, canada goose outlet, pandora charms, canada goose

mmjiaxin said...

celine outlet
oakley sunglasses
air jordan 11
michael kors outlet
ugg outlet
longchamp handbags outlet
ralph lauren outlet
jordan shoes 2015
toms outlet store
lacoste shirts
coach outlet store
oakley sunglasses wholesale
ralph lauren outlet
beats by dre
tory burch outlet
lebron shoes
cheap nfl jersey
true religion outlet
canada goose coats
nike trainers
mm1205

dongdong said...

20161.14wengdongdong
canada goose jacket
michael kors outlet
tommy hilfiger outlet
louis vuitton handbags
christian louboutin outlet
burberry outlet online
michael kors uk
tory burch outlet
adidas shoes uk
north face jackets
louis vuitton
coach outlet
true religion jeans
canada goose outlet
ugg boots
michael kors
michael kors outlet
nike roshe runs
burberry outlet
jeremy scott shoes
nike air jordan
coach outlet
ghd straighteners
sac longchamp
coach outlet
christian louboutin
air jordan pas cher
fake oakley sunglasses
cheap jordans
true religion outlet
kate spade outlet
christian louboutin shoes
longchamp handbags
sac longchamp pliage
ugg boots
ghd
jordan 4
michael kors outlet online
coach factory outlet
coach outlet

风骚达哥 said...

20160301 junda
kate spade handbags
michael kors outlet
michael kors outlet
ralph lauren outlet
michael kors outlet
cheap uggs
ray ban
christian louboutin
coach outlet
michael kors handbags
louboutin pas cher
jordan 4
longchamp bags
christian louboutin uk
michael kors outlet
new balance outlet
michael kors
adidas originals
canada goose outlet
ugg outlet
louis vuitton outlet
ed hardy outlet
kate spade outlet
michael kors outlet
adidas trainers
canada goose outlet
nike trainers
coach factory outlet
jordan 3
adidas shoes uk
basketball shoes
fitflops
longchamp outlet
christian louboutin outlet
cheap jordan shoes
christian louboutin shoes
sac longchamp pliage
ghd hair straighteners
nike air max uk
michael kors handbags

Outlet Wade said...

Cheap Nike Air Max new jordans lebron james shoes 2016 Nike Air Max jordans for sale Cheap Jordans cheap kd shoes Nike Outlet cheap nike basketball shoes jordan shoes kobe basketball shoes Nike free Run Cheap Jordans for sale cheap jordan shoes jordans 2016 Nike Air Max 2016 nike basketball shoes 2016 Nike Store nike basketball shoes 2016 louboutin shoes mizuno shoes red bottom shoes for women red bottoms shoes red bottoms shoes on sale mizuno wave red bottom shoes christian louboutin christian louboutin outlet louboutin sale