Reply to comment

An overview and reference point for WML via Apache and PHP

I am currently working on a "wireless" rev of Screaming-Penguin. Personally I am not a big wireless advocate (not with current bandwidth and other technical limitations) but I do think the technology will be more functional and pervasive in the future. I am interested in it to learn about the emerging technology and because of all the hype.

Its really very easy to do with WML. First of all its important to understand that different phones have different user agents or "browsers." Most support WML but some do not. Just like anything else the target audience must be considered. Note that many phones support both WML and HDML but recommend one or the other. I am sticking to WML for now, just because that is the one that seems more likely to be used prevalently in the future.

So just like the web, you have a client (the phone browser) and a server. Basically any server can serve WML pages to most wireless devices because wireless access providers have gateways setup that connect HTTP requests to WAP requests (or other gateway to device requests.) Therefore your apache server can serve up WML via HTTP as long as the correct content header is sent to the client.

There are 3 basic setup steps to doing this with apache and PHP.

  • 1. Modify the apache httpd.conf to send the wml filetype to PHP
  • 2. Modify the apache httpd.conf to use mod_rewrite and catch wml user agents
  • 3. Setup WML files and make sure to send the content type with the php header function

For step one, you simply modify the "AddType" configuration in apache to grab .wml files and hand them off to the PHP parser. The same way your server uses the PHP engine for .php or .php3 files, you use the same exact AddType for WML:

AddType application/x-httpd-php3 .php3 .php .phtml .wml

Then you want to use the apache mod_rewrite module to look for and rewrite requests from the typical WML type user agents. Mod rewrite can either be complied in or loaded as a module. Either way there is plenty of documentation on mod_rewrite itself at apache.org. For details on the exact mod_rewrite rules for the WML user agents, see this PHPBuilder article which details the specific use of mod_rewrite for this task.

Once you have the AddType for WML to PHP and you have the rewrite rules in place then you simply create WML files that use the PHP header function to set the content type to WML:

header("Content-type: text/vnd.wap.wml");

Once you have that ready then get one of the wireless emulators so that you can test some WML (or even without an apache server and with one of the wireless emulators you can still work on local files.) The OpenWave SDK is very good and it allows you to test a bunch of different phones and devices. Get the OpenWave stuff here.

Those are the basic tenets and the basic setup. This article is intended to be a description of whats happening and a reference to more explicit details. Please check the aforementioned PHP builder article and the links --> for more details (note the Zend tutorial is very good.)   Zend PHP and WML

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <hr> <li> <dl> <dt> <dd> <pre> <b> <h1> <h2> <h3> <blockquote>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.