Art of Mobile
Home GeneralHardwareJavaMMSPerlPHPSMSWAP

Archive for the ‘PHP’ Category

Detect WAP browser and redirect to different url in PHP

Posted in PHP, WAP by artofmobile

Do you want to have the same url for your Web and Wap broswer? The following is the code to do so in PHP:

<?php

$htmlredirect = "http://www.artofmobile.com/index.html";
$wmlredirect = "http://www.artofmobile.com/index.wml";

$br='html';

if(preg_match("/wap/i",$HTTP_ACCEPT)) {

   $br = "wml";
}

if($br == "wml") {
   header("302 Moved Temporarily");
   header("Location: ".$wmlredirect);
   exit;
}

header("302 Moved Temporarily");
header("Location: ".$htmlredirect);

?>
Powered by WordPress. Theme created by Art Of Mobile