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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

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

Post 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.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post 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
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post 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,
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

Post 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,
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post 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,
Last edited by cactus on Sun Jun 22, 2003 11:12 am, edited 1 time in total.
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

Post 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.
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post 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>
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

Post 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. :)
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post 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,
Post Reply