|PHP and WML?|
Phone won't accept .php
| 10:42 pm on Dec 8, 2003 (gmt 0)|
I'm messing around with WML, trying to learn how to add a section to my website that can be accessed by a wireless phone. I can make a page with the extension .wml, and my phone will access the page without problems. If I make a .php file that has WML output, my phone will give me an ambiguous error that says "Not Allowed". Any ideas what I'm doing wrong? Thanks.
| 11:44 pm on Dec 8, 2003 (gmt 0)|
Are you putting the content type header in your php code? something like:-
| 12:25 am on Dec 9, 2003 (gmt 0)|
That's exactly what I was looking for, I think! I saw something like that, but it was in ASP, and it didn't look like that. I'm still a beginner with PHP, and I didn't even think about sending a header. I'll try that and see if it works. Thanks!
| 12:39 am on Dec 9, 2003 (gmt 0)|
Hmmm...looks like that didn't work, either. Here's the code I'm using (since it's not too long)
<?php header("Content-type: text/vnd.wap.wml");?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<card id="Main" title="Test Page">
<?php echo "<p>Goodbye</p>";?>
When I try to load it, my phone just says "Not Acceptable". If I just do a quick .wml page that says the exact same thing, without the PHP, it works fine.
| 12:48 am on Dec 9, 2003 (gmt 0)|
AHA! I figured it out. I used a WML Validator, and by looking at the error that resulted, I determined that the php file was trying to execute the <?xml?> tag, thinking that it was PHP script. So I changed that line from
<?php echo "<?xml version=\"1.0\"?>\n";?>
And now it works! Thanks for the help, olias ^_^
| 12:52 am on Dec 9, 2003 (gmt 0)|
Ahhh yes, I've been looking for the bit of code i did for delivering wap pages, I stumbled into exactly the same two problems but could only remember the first - glad to have been some help!