Home arrow ASP arrow Page 4 - Introduction to WAP using WML, ASP and PHP
ASP

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 / 73
February 22, 2002
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

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 "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

?>

<wml>

<card id="hello">

<p>Today is

<?

echo date("m/d/Y");

?>

</p>

</card>

</wml>


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

<% Response.contenttype="text/vnd.wap.wml" %>

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="hello">

<p>Today is

<%

response.write date

%>

</p>

</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
ASP ARTICLES

- Central Scoreboard with Flash and ASP
- Calorie Counter Using WAP and ASP
- Creating PGP-Encrypted E-Mails Using ASP
- Be My Guest in ASP
- Session Replacement in ASP
- Securing ASP Data Access Credentials Using t...
- The Not So Ordinary Address Book
- Adding and Displaying Data Easily via ASP an...
- Sending Email From a Form in ASP
- Adding Member Services in ASP
- Removing Unconfirmed Members
- Trapping HTTP 500.100 - Internal Server Error
- So Many Rows, So Little Time! - Case Study
- XDO: An XML Engine Class for Classic ASP
- Credit Card Fraud Prevention Using ASP and C...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




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