Home arrow WAP/WML (DO NOT USE) arrow Page 4 - Introduction to WAP using WML, ASP and PHP
WAP/WML (DO NOT USE)

Introduction to WAP using WML, ASP and PHP


As technology changes, so do the tools that we use to manipulate it. Today the Internet is available from a number of devices, both connected and portable. In this article Jean shows us how to use the OpenWave SDK to create WML scripts. He also shows us how to configure IIS and Apache for WAP document requests.

Author Info:
By: Jean-Baptiste Minchelli
Rating: 5 stars5 stars5 stars5 stars5 stars / 9
April 13, 2004
TABLE OF CONTENTS:
  1. · Introduction to WAP using WML, ASP and PHP
  2. · Configuring IIS and Apache
  3. · Hello World in WMLScript
  4. · Generating WMLScript with PHP and ASP
  5. · Conclusion

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Introduction to WAP using WML, ASP and PHP - Generating WMLScript with PHP and ASP
(Page 4 of 5 )

It's possible (and extremely easy) to add dynamic content to our WMLScripts using PHP or ASP. As I mentioned earlier, as long as our PHP/ASP scripts output WML only, then they can be called through a WAP device. You don't have to use ASP or PHP however, and you could just as easily code up a WMLScript using Perl, C#, or JSP.

Think of the possibilities that are available to us by using PHP or ASP to build our WAP applications: databasing, mail servers, LDAP, message queuing, etc. For a script to be WAP compatible, it must output a WML header to the client. It's possible to make Apache/IIS output this header when it receives a request for a WML file, but we can also manually output this header using either ASP or PHP.

Here's some PHP code that generates WML to output the date:

 <?
header("Content-Type: text/vnd.wap.wml");
echo 
"<?xml version="1.0"

"
; echo ""

 <WML><CARD id=hello>
Today is <?  
echo date("m/d/Y"); 


</CARD></WML>



Here's some ASP code that generates exactly the sample WMLScript:

 <% Response.contenttype="text/vnd.wap.wml" %><?xml version="1.0"

<WML><CARD id=hello>
Today is <%      response.write date    %></CARD></WML>



It's crucial not to omit the content type information from the top of each script. It's this information that enables the different agents in the protocol to correctly process the message (gateway, browser, etc). The rest of the code is conventional; you insert the ASP/PHP code inside the WML code. You can therefore carry out any processes you want (database access, image generation, etc).

Here's how the output looked in the OpenWave WAP emulator on my PC:

Running the PHP script through the OpenWave WAP emulator
blog comments powered by Disqus
WAP/WML (DO NOT USE) ARTICLES

- Introduction to WAP using WML, ASP and PHP
- Introduction to Wireless Access Protocol

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials