Is the PC or SmartPhone accessing my site ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Is the PC or SmartPhone accessing my site ?

Post by anjanesh »

Say I have a site called mysite.com and mysite.com/mobile containing PHP scripts that'll generate the WML pages for mobile devices using WAP.
If someone goes to mysite.com on his mobile device, he'll automatically be redirected to mysite.com/mobile.

How can I detect if the browser is a mobile or PC browser ?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd hazard to guess by the simplicity of the mobile's request headers.. particularlly the user-agent string it probably a good indication. :)
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

as well as Accept header
Post Reply