Software Sue

Link to Simply Sue
Link to Sustainability Sue
location: software/markup/wap/generation Skip navigation : Home  

Generating WML Pages

Using CGI (Perl)

Change the header of the document to text/vnd.wap.wml so that the browser will recognise it is a wml file. There are 2 ways to do it in Perl:

First way:

#!/usr/bin/perl

  print "Content-Type: text/vnd.wap.wml\n";
  print "\n";

  print "<?xml version=\"1.0\"?>\n"
  print "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \n"
  print "\"http://www.wapforum.org/DTD/wml_1.1.xml\">\n"
  print "<wml>\n<card id=\"index\" title=\"index\">\n"
  print "<p>This is my first WAP program!</p>\n"
  print "</card>\n</wml>"

Second way:

#!/usr/bin/perl

  print "Content-Type: text/vnd.wap.wml\n";
  print "\n";
qq{<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
           "http://www.wapforum.org/DTD/wml1_1.1.xml">
<wml>
<card id="index" title="index">
<p>Welcome to the world of WAP</p>
</card>
</wml>
};