11.09.06
Hacking WordPress to Automatically Generate WML for WAP Devices - Part II
Well, I finally was able to hook up with Bob Porter to do some testing…… I cannot say I was pleased with the results. The very same redirect codes that work in a stand alone script were not working. The only difference was the “IF” statement to determine if the browser was WAP enabled.
After a day of email communication, we finally got together via phone. Then it was about a 1/2 an hour before I had the AHA moment.
We have successfully tested the automatic discovery of WAP enabled devices!! At least for Windows CE based devices. So, I am declaring success.
If you have some other WAP device, please test it here and let me know the results.
Here is the index.php that I created to replace the one provided by WordPress… If you use it, you will have to modify the location you redirect to.
<?
$pos = stripos($HTTP_ACCEPT, "VND.WAP.WML");
if ($pos === false)
{
$pos = stripos($HTTP_USER_AGENT, "WINDOWS CE");
if ($pos === false)
{
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
exit(0);
}
else
{
header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: http://www.spryken.com/blog/wp-wap.php" );
exit(0); // This is Optional but suggested, to avoid any accidental output
}
}
else {
header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: http://www.spryken.com/blog/wp-wap.php" );
exit(0); // This is Optional but suggested, to avoid any accidental output
}
?>
Technorati Tags: wordpress, wap, blogs, programming, php
powered by performancing firefox
Permalink 2,037 views

A Scout’s Campfire » A Scout’s Campfire is WAP Enabled said,
November 10, 2006 at 3:54 pm
[...] If you are interested in how I did it, see Hacking WordPress to Automatically Generate WML for WAP Devices - Part II on my personal/technical blog Rants and Raves. [...]