Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Introduction to WML, Apache, and PHP
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 :)
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:
<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.
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.
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.
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

[Page 1]  [Page 2]  


Comments:
RE: Invoke PHP from WML scriptgrrat mike05/19/08 04:31
good manualMiguel12/17/07 23:00
Invoke PHP from WML scriptKalpesh05/21/07 06:49
Lack of informationDesmond04/25/07 07:15
RE: Solution: wml+apache+php4jack02/10/06 03:09
RE: Solve WML problems hereaskali mohamed11/28/05 13:16
Solve WML problems hereGreg Robbins10/27/05 03:54
HawHaw ClassJonathan Cutrer09/12/05 22:41
wap forum scriptErnie09/11/05 09:02
WML Link ProblemBiranchi Narayan Mohapatra08/11/05 02:54
Integrate php into websphereSuwit 07/29/05 09:53
PHP Content-Dispositioncyril06/30/05 09:41
RE: How to run php in appache server ?siva04/29/05 03:48
RE: cant use the include PHP commandJay04/02/05 05:46
PHP+WML problemubaid02/17/05 06:00
Apache and PHP Install HOWTOThangalin02/15/05 03:41
RE: PHP & WMLelhouma02/05/05 05:58
How to use mailshazzad01/05/05 05:06
cyber cafe management software Mpeirwe11/24/04 12:29
RE: Any server can be a WAP server ?Chiral Software02/09/04 15:57
RE: Setting up apache for WML on shared serverMiss.Spark01/08/04 00:15
PHP & WMLDaniel Stirling06/19/03 13:09
Works fine for meKevin05/07/03 12:04
read if you need help installing apache linuxMichael Olsen02/16/03 12:33
RE: PHP & WebSpherekrylor01/12/03 22:15
WML and PHP short opening tag...Edwin Zuidema01/03/03 04:24
PHP & WebSpheremathy paesen10/17/02 09:28
i no nothingkong10/16/02 03:29
Manual de PHPFernando Zamarripa Rodriguez10/15/02 10:38
Manual de PHPFernando Zamarripa Rodriguez10/15/02 10:25
RE: PHP Starting tutorialClarke Drover10/02/02 12:40
wml + php solution...Johnny10/01/02 18:00
Mandrake 8.2 + apache + phpSpencer09/30/02 09:59
RE: PHP Starting tutorialmeenu chugh09/23/02 08:16
RE: It works with wml but not wml/phppeter garner09/16/02 10:59
RE: another wml php problemPan09/13/02 02:29
I have a problem... I'm trying to put........Tom09/02/02 11:56
RE: PHP Starting tutorialSam09/01/02 03:51
Capacity PlanningBiohazard07/28/02 08:11
RE: How to run php in appache server ?joe07/16/02 11:56
wml files with phpJose Garcia07/10/02 10:12
RE: Doing redirection with PHPJin07/04/02 14:46
Solution: wml+apache+php4Erik Lonroth07/04/02 05:54
Ayuda por favorLancer_07/01/02 10:59
RE: PHP Starting tutorialKAMTO YOUMBI EVARISTE LEOPOLD07/01/02 06:11
RE: how to install php in linux mandrakeElwaleed Elbashier06/28/02 07:37
Wap forum (message board) scriptChris06/15/02 16:00
RE: another wml php problemRichard D. Williams06/13/02 12:20
RE: another wml php problemkenneth05/24/02 04:11
another wml php problemSam05/23/02 06:45
Apache SEND MAIL !!!!Syman05/22/02 09:46
php+wml newcomerSam05/20/02 10:57
need helpvshield05/18/02 00:03
wml,php,mysql.Need help!pitza calin05/15/02 13:47
you can just use *.php tooHanzel05/14/02 11:30
cant use the include PHP commandBrutal_truth04/29/02 20:20
How to PHPAzam04/29/02 07:26
RE: HELP WITH MIME OF APACHE and jspwael al hasan04/22/02 08:26
xml to wap using phplokman04/16/02 23:48
How to run php in appache server ?sajith04/11/02 02:34
RE: PHP/WML problemRobert Bares (b-w-d.net)03/24/02 08:51
php newbiefarah03/20/02 22:49
php editormynn03/10/02 22:34
Re: Manual de PHPRosana Zambrano02/26/02 17:58
how to install php using php windows installeharikrishna02/18/02 13:46
RE: Browser doesn't show php resultstigger01/26/02 14:31
HELP WITH MIME OF APACHEaasim01/25/02 18:06
i need some articles and magazines about wapMuhammad Aslam Baig01/24/02 02:31
PHP/WML problemtigger01/23/02 10:39
how to install php in limux mandrakeFauzi01/18/02 12:08
preguntaHermy01/12/02 09:37
preguntaHermy01/12/02 09:14
kickout rewritehendrik01/07/02 17:44
It works with wml but not wml/phpAndreas Amsenius01/05/02 12:45
How to insert data to mysql from WAP?tom12/27/01 12:47
How to insert data to mysql from WAP?tom12/27/01 12:38
RE: PHP free space for WMLBrian12/20/01 19:18
statisticsMr Solsona12/17/01 07:44
RE: WMLScriptamarnath12/11/01 00:46
please!!!yh.y12/07/01 20:39
RE: Browser doesn't show php resultsumeshkumar12/04/01 05:11
Execute an apache script in phphugo12/03/01 07:42
WAP, PHP, and POSTkyle11/22/01 19:10
RE: This doesnt work for me either...kyle11/22/01 17:44
Need help from a newbieAlfredo10/26/01 22:17
Please someone help me!!Fadi10/18/01 02:20
Browser doesn't show php resultsDave Teu09/21/01 06:42
It wont work no matter what!!! Help?Charles K09/20/01 09:14
WMLScriptIgor09/06/01 01:08
requestuday08/16/01 04:00
PHP to generate dynamic XML pagesAntoine Trannoy08/06/01 05:19
PHP Starting tutorialPrashant07/27/01 22:53
RE: PHP free space for WMLHellek07/18/01 06:46
thanksmozaffar07/16/01 01:27
questionoliver06/27/01 00:03
Re: A better mod_rewrite set upDennis Bath06/14/01 23:00
Mod_rewrite set up a problemDennis Bath06/14/01 20:46
PHP free space for WMLtonino_forma06/13/01 02:40
method not allowedjane06/12/01 01:27
help!Disfasia06/08/01 00:56
Send IP packet with wml?Charles de La Ferriere05/22/01 05:25
RE: Any server can be a WAP server ?Hythian05/15/01 07:37
mod_rewrite.so?Henry Malthus05/15/01 00:02
RE: This doesnt work for me either...Todd04/27/01 18:29
RE: Doing redirection with PHPpoetic04/17/01 18:57
Setting up apache for WML on shared serverchad nantais04/17/01 02:30
A better mod_rewrite setup for someDuncan Kimpton04/01/01 16:21
RE: This doesnt work for me either...Duncan Kimpton04/01/01 11:30
FATAL Error from <?xml version="1.0"?>Wes03/26/01 11:16
RE: This doesnt work for me either...Ke Xu03/23/01 13:31
RE: clearing input boxAdnan Siddiqi03/08/01 11:12
clearing input boxmaha03/07/01 12:35
Physical connectionsNeville02/22/01 02:05
WAP To Apache: READ THISMichael Welch02/18/01 18:27
basic steps in setting up the wap sitesreekanth02/09/01 08:10
WorksJesse02/07/01 09:22
RE: This doesnt work for me either...Joe Jenkins02/06/01 08:38
RE: This doesnt work for me either...Mike Johnson02/06/01 07:36
RE: This doesnt work for me either...Pam Joseph02/05/01 12:12
More optionsDel02/03/01 15:35
RE: The nice part...Joe02/03/01 09:39
RE: more than one WML page?Mike Johnson02/02/01 18:37
Connection to service failedJesse02/02/01 15:11
more than one WML page?Joe Jenkins02/01/01 17:31
This doesnt work for me...Joe Jenkins02/01/01 13:54
RE: Any server can be a WAP server ?Sid01/31/01 06:47
RE: Some hints...Andrew Spiers01/28/01 16:13
Some hints...Oliver Blasnik01/27/01 04:55
RE: Any server can be a WAP server ?Gareth Bromley01/27/01 04:21
RE: Doing redirection with PHPMatthijs Tempels01/25/01 15:02
A title might come in handyPablo01/25/01 09:47
RE: Doing redirection with PHPNeil Moomey01/23/01 10:40
RE: Any server can be a WAP server ?Mike Johnson01/19/01 22:51
Any server can be a WAP server ?jaydj01/19/01 19:00
RE: The nice part...Tom Anderson01/19/01 18:36
The nice part...Benjamin Smith01/19/01 17:09
RE: Doing redirection with PHPTom Anderson01/19/01 13:51
Thanks for the article!Tom Anderson01/19/01 13:50
RE: read a french exemple wml/php/mysqlPatrick01/19/01 11:30
read a french exemple wml/php/mysqlmarc 01/19/01 02:58
The WML is wrong in these examplesAndrew Spiers01/06/01 15:52
Doing redirection with PHPCoolvibe01/05/01 10:17
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.

 

Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs