Internet Marketing Forum

Internet Marketing Forum


For Webmasters and Entrepreneurs
|
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 22, 2012, 06:57:03 PM

Login with username, password and session length

Before you can inspire with emotion, you must be swamped with it yourself. Before you can move their tears, your own must flow. To convince them, you must yourself believe.


- Winston Churchill

|-   Internet Marketing Forum > Online Business Discussions > Website Design and Maintenance > Programming
+  

Detect a WAP browser in PHP ?

0 Members and 1 Guest are viewing this topic.
Pages: [1] Reply to Thread
Author Topic: Detect a WAP browser in PHP ?  (Read 1299 times)
OfflineGalaxian
Senior Member
Galaxian is on a distinguished road
Joined: Oct 2007
Posts: 286


Avatar of Galaxian

The internet is my playground.

View Galaxian\s Profile
Gender: MaleAries United States
notepad Jan 15, 2008, 02:09:06 AM #1
I'm making an application that is designed for mobile devices and I would like to know how to detect a WAP browser in PHP so I can direct it to the WAP page instead of a normal page for regular browsers.
OfflineAceCoder
Junior Member
AceCoder is on a distinguished road
Joined: Oct 2007
Posts: 79



View AceCoder\s ProfileWWW
United States
notepad Feb 01, 2008, 04:46:11 PM #2
I use this script to detect WAP...

Code:
if(strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0) {

$mode = "WML";

}else{

$device=substr(trim($_SERVER['HTTP_USER_AGENT']),0,4);

if($device=="Noki" || // Nokia phones and emulators
$device=="Eric" || // Ericsson WAP phones and emulators
$device=="WapI" || // Ericsson WapIDE 2.0
$device=="MC21" || // Ericsson MC218
$device=="AUR " || // Ericsson R320
$device=="R380" || // Ericsson R380
$device=="UP.B" || // UP.device
$device=="WinW" || // WinWAP device
$device=="UPG1" || // UP.SDK 4.0
$device=="upsi" || // another kind of UP.device ??
$device=="QWAP" || // unknown QWAPPER device
$device=="Jigs" || // unknown JigSaw device
$device=="Java" || // unknown Java based device
$device=="Alca" || // unknown Alcatel-BE3 device (UP based?)
$device=="MITS" || // unknown Mitsubishi device
$device=="MOT-" || // unknown device (UP based?)
$device=="My S" || // unknown Ericsson devkit device ?
$device=="WAPJ" || // Virtual WAPJAG [url]www.wapjag.de[/url]
$device=="fetc" || // fetchpage.cgi Perl script from [url]www.wapcab.de[/url]
$device=="ALAV" || // yet another unknown UP based device ?
$device=="Wapa" || // another unknown device ("Wapalyzer"?)
$device=="SEC-") // Samsung Phone
{
$mode = "WML";
}else{
$mode = "HTML";
}
}

if ( $mode == "WML" ){
// do something for WAP browser
}else{
         // do something for normal browser
}


Latest Blog Post : PHP – Pass by Reference or Pass by Value

OfflineCode4Gold
Administrator
Code4Gold is a jewel in the roughCode4Gold is a jewel in the roughCode4Gold is a jewel in the roughCode4Gold is a jewel in the rough
Joined: Jan 2006
Posts: 6215


Avatar of Code4Gold

Administrator

View Code4Gold\s ProfileWWW
Gender: MaleGemini United States
notepad Feb 12, 2008, 04:43:56 AM #3
That code seems to work very well for a couple of the .mobi sites I've been developing. I've also found it useful to monitor the server logfiles to see if there's any unidentified USER AGENT's and attempt to calibrate the WAP browser as needed.

A lot of the newer phones, like the iPhone, as chaning the way WAP requests are handled and it almost reminds me of the early days of the internet when a designer have to design for 640x480 because some CFO or CIO was surfing the site on his ThinkPad (that only did those resolutions back then).

Latest Blog Post : 8 Tips for Creating a Marketing Buzz

OfflineGalaxian
Senior Member
Galaxian is on a distinguished road
Joined: Oct 2007
Posts: 286


Avatar of Galaxian

The internet is my playground.

View Galaxian\s Profile
Gender: MaleAries United States
notepad Mar 28, 2008, 04:11:22 PM #4
The script works great. It's detecting my phone but the only problem I'm having is when accessing from a Nextel phone.
Offlinemarkfinn
Beginner
markfinn is on a distinguished road
Joined: Sep 2011
Posts: 12


anonymous avatar

View markfinn\s Profile
notepad Sep 20, 2011, 12:39:53 PM #5
I'm making an application that is

OfflineVidal
Administrator
Vidal is on a distinguished road
Joined: Mar 2006
Posts: 495


Avatar of Vidal

Happiness is right around the corner.

View Vidal\s Profile
Gender: FemaleAquarius United States
notepad Sep 20, 2011, 05:57:43 PM #6
Quote from: markfinn on Sep 20, 2011, 12:39:53 PM
I'm making an application that is

Yes? That is?? Seems like you're copying the first few words of the first post in a thread and reposting them?

Please stop immediately or you will be banned.

Did you eat today? There millions of people starving in the world.
Do something about it at The Hunger Site
Summer Savings! $7.49 .com domains at GoDaddy.com!
Pages: [1] Reply to Thread


Code4Gold Internet Marketing Forum © 2006-2011 Resdaz Media LLC - All Rights Reserved
Forum Software Powered by SMF - © 2001-2008, Lewis Media. All Rights Reserved.