Thursday, May 08, 2008

แปลง Header ของ Browser (The proximitron)

ที่จริง ถ้าเราอยากเล่น wap โดยที่ไม่ต้องใช้มือถือก็สามารถทำได้
เดี๋ยวนี้ wap มันจะเขียนด้วย xhtml (หรือคิดไปเองนะ)
หรือบางทีก็เป็น html ดุ้นๆก็มี ดังนั้น เราใช้ Browser ธรรมดาก็เปิดได้

แต่ถ้าเป็น Wap จริง มี Mozilla FireFox ที่สามารถอ่าน Wap เข้าใจ
ก็ใช้จิ้งจอกน้อยของเราเข้าไปเล่น ไปโหลดเกม ริงโทนได้

แต่กระนั้น สำหรับบาง site ที่ต้องการจำกัด หรือบันทึกเบอร์โทรศัพท์ หรือมีการตรวจสอบ User Agent
ที่จริงจะเอาไปใช้มากในการแบ่ง user ที่เข้ามาที่ website ผ่านทางมือถือ หรือผ่านทางคอม ให้มาที่ url เดียวกัน แต่จะตรวจสอบ header แล้ว redirect ไปยังที่ๆควรจะไป

ถ้ารู้ว่าเป็น mobile ก็จะส่งไปยัง content ของ mobile ซึ่งเราก็อยากจะเข้าถึง content ของ mobile นี่นา แค่เราใช้ browser บนคอมเท่านั้นเอง

วิธีการก็คือ เราต้องรู้ User-Agent ของโทรศัพท์เราจริงๆว่า มันเขียนยังไง (เป็น text ยาวๆอันนึง)
แล้วเราก็มา simulate ใส่ไว้ในโปรแกรม Proximiton ให้มันรันเป็น Proxy แล้วก็ set ให้ browser ตั้ง Proxy เป็น localhost นี้

User-Agent หาได้ทั่วไปตามคนใจดีมาโพส หรือจะใช้โค้ด PHP ในการดึงก็ได้ จากที่เอามาเค้าดูจาก Phpinfo ก็มี
ตามนี้ http://www.mattcutts.com/blog/iphone-user-agent/

ก็จะมี header ของ มือถือ หรือ iphone ก็ลอง search หาจาก google ดูได้


The User-Agent header contains a line of text that can be used to identify a user agent and client device. Most of the time, we can find the device model and manufacturer from the User-Agent header. It may also contain information such as the client device's OS version, browser version, Java capabilities, etc.
Some example User-Agent headers are provided below.

The User-Agent header of the Nokia 6230i cell phone:
Nokia6230i/2.0 (03.25) Profile/MIDP-2.0 Configuration/CLDC-1.1

The User-Agent header of the Nokia 6600 cell phone:
Nokia6600/1.0 (4.03.24) SymbianOS/6.1 Series60/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0

The User-Agent header of the Sony Ericsson T610 cell phone:
SonyEricssonT610/R501 Profile/MIDP-1.0 Configuration/CLDC-1.0

The User-Agent header of the Sony Ericsson K700i cell phone:
SonyEricssonK700i/R2AG SEMC-Browser/4.0.3 Profile/MIDP-2.0 Configuration/CLDC-1.1

The User-Agent header of Openwave Mobile Browser 6.2.2:
OPWV-SDK/62 UP.Browser/6.2.2.1.208 (GUI) MMP/2.0

-----------------------------------

Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3

ลองดูนะ




ส่วนบาง site จะมีการ charge ตังด้วย operator อย่าง AIS DTAC .. ก็จะมีการบวก Header เพื่อแนบเบอร์โทรเราไปให้ ที่จริงเราก็สร้าง header นี้ได้ถ้าเรารู้คำ แล้วเบอร์ที่เรากรอกไปก็อาจจะซวยได้ เพราะโดนไป charge เงิน ดังนั้น ก็ขอให้เป็นการสู้กันระหว่า Admin กะพวกเสียดายตังละกัน เขียนเอาไว้ช่วยจำ เพราะเคยทำมาจ้า

1 comment:

sangza said...

http://www.pdamobiz.com/forum/forum_posts.asp?TID=13014&KW=user+agent

เวบที่เค้ารวม user agent
เค้าว่า Netfront (browser ตัวนึง) กำหนด user-agent เองก็ได้อะ

แต่มีแต่ browser บน PC ธรรมดาๆ

วิธีเปลี่ยน
http://www.pdamobiz.com/forum/forum_posts.asp?TID=13793&PN=1