homepage Welcome to WebmasterWorld Guest from 54.237.77.181
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Smartphone, Wireless, and Mobile Technologies
Forum Library, Charter, Moderators: bakedjake

Smartphone, Wireless, and Mobile Technologies Forum

    
PHP and WML?
Phone won't accept .php
PitMonkee




msg:931491
 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.

 

olias




msg:931492
 11:44 pm on Dec 8, 2003 (gmt 0)

Are you putting the content type header in your php code? something like:-

header("Content-type: text/vnd.wap.wml");

PitMonkee




msg:931493
 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!

PitMonkee




msg:931494
 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");?>
<?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="Main" title="Test Page">

<p>Hello</p>

<?php echo "<p>Goodbye</p>";?>

</card>
</wml>

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.

PitMonkee




msg:931495
 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

<?xml version=\"1.0\"?>

<?php echo "<?xml version=\"1.0\"?>\n";?>

And now it works! Thanks for the help, olias ^_^

olias




msg:931496
 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!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Smartphone, Wireless, and Mobile Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved