For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > PHP with WML problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP with WML problem
Brian A

2004-07-26, 8:57 am

Xref: 127.0.0.1 alt.comp.lang.php:6550

I have tried the script below as a test and named it test.wml
..........................
<?php
/* Some not needed php vars for example */
$page_name ='Test';
$page = '<p>This is the page content</p>';
/* Header stuff */
header('Content-Type: text/vnd.wap.wml', true);
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');

print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
/* Exit PHP and print out wml doc
save as *.php
*/
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="Page<?php echo $page_name; ?>" title="<?php echo $page_name;
?>">
<p>
<strong><?php echo $page_name; ?></strong>
</p>
<?php
echo $page;
?>
<p><br />
<anchor>Home
<go href="/" />
</anchor>
<do type="prev" label="Back"><prev/></do>
</p>
</card>
</wml>
....................................................

I have used the following in a .htaccess file

........................................................
# For PHP 4.x :
AddType application/x-httpd-php .wml
.........................................................

The .htaccess is doing something because I have no success without it.

I am using the openwave 6.2.2 SDK viewer/emulator to test the script
along with a nokia 7210


These are the results:

1. Using my own local server - Script OK on Openwave.

2. Using my Net webspace - Openwave reports an error, for all three of
the PHP header command lines, 'Headers already sent' - If I remove the
PHP header commands it works perfectly.

3. Tried the script from my Net web site on the nokia 7210 - headers
included or not the 7210 reports
'unknown format' and doesn't attempt to do anything.

So what is going wrong and how can I solve this problem?

Remove 'no_spam_' from email address.
Colin McKinnon

2004-07-26, 3:56 pm

Brian A wrote:

> I have tried the script below as a test and named it test.wml
> .........................
> <?php
> /* Some not needed php vars for example */

<snip>

> # For PHP 4.x :
> AddType application/x-httpd-php .wml
> ........................................................
>
> The .htaccess is doing something because I have no success without it.
>


looks OK...

> 2. Using my Net webspace - Openwave reports an error, for all three of
> the PHP header command lines, 'Headers already sent'


That looks like the root of the problem. Is that a space at the beginning of
the file? Anything before the first '<?php' will flush the headers. Or the
server may have auto_prepend_file set to something in the php.ini file.

HTH

C.
Brian A

2004-07-26, 8:55 pm

Xref: 127.0.0.1 alt.comp.lang.php:6563

On Mon, 26 Jul 2004 17:28:56 +0100, Colin McKinnon
<colin.deletethis@andthis.mms3.com> wrote:

>Brian A wrote:
>
><snip>
>
>
>looks OK...
>
>
>That looks like the root of the problem. Is that a space at the beginning of
>the file? Anything before the first '<?php' will flush the headers. Or the
>server may have auto_prepend_file set to something in the php.ini file.
>
>HTH
>
>C.

Colin you are a star !! Thank you so much. That WAS the problem. All
received on my 7210 ! Now onto bigger things!! Thanks again !


Remove 'no_spam_' from email address.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com