--- index.php ---
<?php
// Browser detection & router
// By: Dragnovich@yahoo.com
// ###########################################
if(eregi("text/vnd.wap.wml",$HTTP_ACCEPT)) {
// Si el Navegador soporta WML
$url = "/wap/index.wml";
}
else {
$url = "/wap/main.php";
}
header("Location: $url");
exit;
?>
--- fin de index.php ---
o se puede utilizar de la siguiente manera.
--- index.php ---
<?php
// Browser detection & router
// By: Dragnovich@yahoo.com
// ###########################################
if(eregi("text/vnd.wap.wml",$HTTP_ACCEPT)) {
// Yes Browser is understand WML format
header("Location: /wap/index.wml");
exit;
}
?>
<html>
CODIGO HTML O PHP.......
</html>
--- fin de index.php ---
En Perl se puede hacer la misma detección con la función...
--- index.pl ---
#/usr/bin/perl -w
# Browser detection & router
# By: Dragnovich@yahoo.com
###########################################
if($ENV{"HTTP_ACCEPT"} =~ /text\/vnd\.wap\.wml/i) {
$url = "index.wml";
}
else {
$url = "main.wml";
}
print "Location: $url\n\n";
exit;
--- END ---