Page 1 of 1

php page, browse over thru GPRS using mobile phone...

Posted: Sun Jun 22, 2003 9:41 am
by mickey
Hello

i am trying to feed a dynamic wap/wml page using PHP on a mobile phone's wap/wml browser..

i kept on getting errors.. any idea why? must be my host's web server or something?

for instance, i place this url on my nokia 7650: http://www.angrysoft.com/test.php

but i just get error.. many thanks.

Posted: Sun Jun 22, 2003 9:41 am
by AVATAr
what error?

thisone:

Code: Select all

Parse error: parse error, unexpected T_STRING in /home/mickey/public_html/test.php on line 1
show us your code

Posted: Sun Jun 22, 2003 10:13 am
by cactus
In addtion, are you throwing the correct mime type for your WML?

Code: Select all

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

Posted: Sun Jun 22, 2003 11:03 am
by mickey
hello!!!

thanks for the quick reply, yep, that's the error.. and no mime type hmm...

anyway this is my entire php page that generates the wml page:

Code: Select all

<?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="HTML" title="HTML Tutorial">

<?php
print("<p>Our HTML Tutorial is an award winning tutorial from W3Schools.</p>");
?>

</card>

<card id="XML" title="XML Tutorial">
<p>
Our XML Tutorial is an award winning 
tutorial from W3Schools.
</p>
</card>

</wml>
anyway, i'll try placing the mime type now,

Posted: Sun Jun 22, 2003 11:06 am
by cactus
Just another adition, you will need to echo out your XML declaration if you have short tags <? ?> enabled:

Code: Select all

echo '<?xml version="1.0"?>';
Regards,

Posted: Sun Jun 22, 2003 11:10 am
by mickey
hmm.., i don't know, my nokia 7650 is not displaying the wml page...


here is the entire php page now:

Code: Select all

<?php
print("<?xml version="1.0"?>"); 
?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<meta http-equiv="Content-Type" content="text/vnd.wap.wml;">

<wml>

<card id="HTML" title="HTML Tutorial">

<?php
print("<p>Our HTML Tutorial is an award winning tutorial from W3Schools.</p>");
?>

</card>

<card id="XML" title="XML Tutorial">
<p>
Our XML Tutorial is an award winning 
tutorial from W3Schools.
</p>
</card>

</wml>
thanks.

Posted: Sun Jun 22, 2003 11:17 am
by cactus
2 things, I would remove the meta tag and throw the mime type via PHP, secondly, in the code you posted, you haven't shown your XML declaration at the top of the page.

Also ;) Try using a single "card" as a test first:

Code: Select all

<?php
header( "Content-type: text/vnd.wap.wml");
echo '<?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="HTML" title="HTML Tutorial">
	<?php 
		echo "<p>Our HTML Tutorial is an award winning tutorial from W3Schools.</p>"; 
	?>
	</card>
</wml>

Posted: Sun Jun 22, 2003 11:22 am
by mickey
hello cactus!

thanks very much. it works now!! most likely it is this line that makes it work:

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

again, thanks very much, your code was very helpful. :)

Posted: Sun Jun 22, 2003 11:25 am
by cactus
If you do use meta tags in WML you will still need to encapsulate them in the <head></head> part of the document (ommited here, because you don't need them, but still "well formed").

As a tip, test your pages in Opera, it has a WML engine and is great for debugging your XML/WML.

Regards,