Setting up Apache
Ok, now the fun part. In order for apache to catch what a wireless device visits your
server, you need to set up your httpd.conf ( my file is located in /etc/httpd/conf/ ) file, I am using PHP3 so all changes are made accordingly. Before you start you may want
to make a backup copy of your httpd.conf file, just in case 🙂
server, you need to set up your httpd.conf ( my file is located in /etc/httpd/conf/ ) file, I am using PHP3 so all changes are made accordingly. Before you start you may want
to make a backup copy of your httpd.conf file, just in case 🙂
Step 1: First, we need to use the AddType function to add a new mime
type. You need to go to to the script where you define php. It looks something like below:
type. You need to go to to the script where you define php. It looks something like below:
<IfModule mod_php3.c>   AddType application/x-httpd-php3 .php3 .php .phtml   AddType application/x-httpd-php3-source .phps </IfModule>
Needs to be changed to:
<IfModule mod_php3.c>   AddType application/x-httpd-php3 .php3 .php .phtml .wml   AddType application/x-httpd-php3-source .phps </IfModule>
This will use the php compiler on all .wml pages it encounters.
Step 2: Uncomment the apache Load Module and Add Module
change:
#LoadModule rewrite_module modules/mod_rewrite.so #AddModule mod_rewrite.c
to:
LoadModule rewrite_module modules/mod_rewrite.so AddModule mod_rewrite.c
Step 3: We’ll use apache mod_rewrite module (only available in
version 1.2+ ). Using this, you can rewite requested URL’s on the fly, as certain
conditions are met. You need to place this code snipplet at the bottom of the page.
version 1.2+ ). Using this, you can rewite requested URL’s on the fly, as certain
conditions are met. You need to place this code snipplet at the bottom of the page.
RewriteEngine On # Catch most WAP browsers RewriteCond %{HTTP_ACCEPT} text/vnd.wap.wml [OR] # WinWAP, WAPjag RewriteCond %{HTTP_USER_AGENT} wap [OR] #Nokia emulators (sdk) RewriteCond %{HTTP_USER_AGENT} 7110 # Rewrite to where your wireless page is located RewriteRule ^[./](.*)$ /home/mydirectory/wireless/home.wml [L]
Now, you will need to restart the apache server.
Creating your first WML/PHP wireless page
Ok, now that we have everything set up, lets create our first page. In order for a wireless
device to access a page compiled using php, you need to send the correct header information.
<?php
# Send the header information<br>
header("Content-type:Â text/vnd.wap.wml");
?>
# put in the wml code <wml> <card id='home'> <p> My first test page <p> </card> </wml>
You have just completed your first ‘simple’ wireless page. Now, let’s try to do something
just a little harder.
just a little harder.
You need to check your site using a WAP-compatible device. I use the
Phone.com Software Development kit, which contains
the UP.Simulator, to check my wireless pages. It allows the user to choose different phones
and see what their wireless pages look like through the different devices.
Phone.com Software Development kit, which contains
the UP.Simulator, to check my wireless pages. It allows the user to choose different phones
and see what their wireless pages look like through the different devices.
A more indepth article can be found at here.
To view what this tutorial accomplished, go to www.anautics.com using your wireless device or browser.
More information can be obtained through the following resources:
— Mike