Entry
How can I produce WML from PHP?
May 16th, 2000 23:28
Nathan Wallace, SANIsoft
Here is a simple example of how I spew out WML using PHP3. As an added
factor - I am using PHPlib for authentication. Check out the WML FAQ for
more on using PHPlib authtentication with WML- search the list archive
for the URL
=====================================================
<?php
header("Content-type: text/vnd.wap.wml"); // Tell browser that I am
sending
wml
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //We dont want the
protected pages to be cached
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
page_open(array("sess" => "redwap_Session",
"auth" => "redwap_Auth")); // This is the call to
PHPlib
for starting session and Authentication code
echo("<?xml version=\"1.0\"?>\n"); // This could have been below hard
coded
:-)
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"
\"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>
<wml>
<card id="edit" title="redDiary">
<p><anchor>Search
<go href="search.php3" />
</anchor>
</p>
<p><anchor>Add Contact
<go href="addcontact.php3"/>
</anchor></p>
<p><anchor>Send Email
<go href="sendmail.php3" />
</anchor>
</p>
<p><anchor>Log Out
<go href="logout.php3" />
</anchor>
</p>
<p><img src="msi.wbmp" alt="MSI Logo" />Menu<img src="ss.wbmp" alt="SS
Logo"
/>
</p>
</card>
</wml>
<? page_close() ?> // Do not forget to close all your pages
=============================================