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.
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:
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
Here's some ASP code that generates exactly the sample WMLScript:
<% Response.contenttype="text/vnd.wap.wml" %>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
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: