[PHP] WML/WAP and PHP

2001-01-16 Thread Rick Hodger

Here's a fun little thing I discovered, possibly a bug in PHP itself?

To output a WAP page you must output a content-type header else the phone's
browser won't recognise the page. Dead simple. Use:

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

And all is well and good as long as you use echo/printf etc to output your
page. The second you deviate out of PHP and back to HTML the content-type
gets overwritten with a text/html, and so the page doesn't work.  ASP used
to be able to cope with this, is it a bug or something I'm doing wrong?

--
Rick Hodger



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] WML/WAP and PHP

2001-01-16 Thread Pavel Kalian

Hi Rick,
you are not doing anything wrong. You just have to send the proper
content-type depending on what you're outputing. For example if you want to
produce a gif image you have to use header("Content-type: image/gif");
There's nothing wrong with it as PHP can't predict what you want to do.
text/html is set as default simply because it's the type most users in most
cases need.

Pavel

- Original Message -
From: "Rick Hodger" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 16, 2001 2:10 PM
Subject: [PHP] WML/WAP and PHP


 Here's a fun little thing I discovered, possibly a bug in PHP itself?

 To output a WAP page you must output a content-type header else the
phone's
 browser won't recognise the page. Dead simple. Use:

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

 And all is well and good as long as you use echo/printf etc to output your
 page. The second you deviate out of PHP and back to HTML the content-type
 gets overwritten with a text/html, and so the page doesn't work.  ASP used
 to be able to cope with this, is it a bug or something I'm doing wrong?

 --
 Rick Hodger



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] WML/WAP and PHP

2001-01-16 Thread Rick Hodger


"Pavel Kalian" [EMAIL PROTECTED] wrote in message
028e01c07fc1$dffdecf0$8361d4c2@pavelk">news:028e01c07fc1$dffdecf0$8361d4c2@pavelk...
 Hi Rick,
 you are not doing anything wrong. You just have to send the proper
 content-type depending on what you're outputing. For example if you want
to
 produce a gif image you have to use header("Content-type: image/gif");
 There's nothing wrong with it as PHP can't predict what you want to do.
 text/html is set as default simply because it's the type most users in
most
 cases need.

Yes, I know that. But what I'm saying is that eg.

?php
header("Content-type: text/vnd.wap.wml");
?
wml
card
pHello world!/p
/card
/wml

...gets put out with a text/html content type as opposed to the specified
text/vnd.wap.wml. Having said that, I just tried it on the linux machine and
it worked fine. A Windows thing?

--
Rick Hodger



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] WML/WAP and PHP

2001-01-16 Thread Jon Haworth

I seem to remember reading something very recently, possibly on this list,
about WML. IIRC, if you drop out of PHP at any point the rest of the
document gets treated as text/html. Try something like

?php
header("Content-type: text/vnd.wap.wml");
echo("wmlcardpHello world!/p/card/wml");
?

and see if it works.

Sorry to be vague, but I didn't pay *that* much attention to it at the time!

HTH
Jon


-Original Message-
From: Rick Hodger [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2001 16:02
To: [EMAIL PROTECTED]
Subject: Re: [PHP] WML/WAP and PHP



"Pavel Kalian" [EMAIL PROTECTED] wrote in message
028e01c07fc1$dffdecf0$8361d4c2@pavelk">news:028e01c07fc1$dffdecf0$8361d4c2@pavelk...
 Hi Rick,
 you are not doing anything wrong. You just have to send the proper
 content-type depending on what you're outputing. For example if you want
to
 produce a gif image you have to use header("Content-type: image/gif");
 There's nothing wrong with it as PHP can't predict what you want to do.
 text/html is set as default simply because it's the type most users in
most
 cases need.

Yes, I know that. But what I'm saying is that eg.

?php
header("Content-type: text/vnd.wap.wml");
?
wml
card
pHello world!/p
/card
/wml

...gets put out with a text/html content type as opposed to the specified
text/vnd.wap.wml. Having said that, I just tried it on the linux machine and
it worked fine. A Windows thing?

--
Rick Hodger



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] WML/WAP and PHP

2001-01-16 Thread Pavel Kalian

are you sure that there's nothing in the file in before you call the
header() function? The situation you describe could happen if there was an
empty line at the begining of the file and the warnings were turned off.
When I tried your code it worked as expected:

C:\c:\php4\php test.php
X-Powered-By: PHP/4.0.4
Content-type: text/vnd.wap.wml

wml
card
pHello world!/p
/card
/wml
C:\

Pavel

- Original Message -
From: "Rick Hodger" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 16, 2001 5:02 PM
Subject: Re: [PHP] WML/WAP and PHP



 "Pavel Kalian" [EMAIL PROTECTED] wrote in message
 028e01c07fc1$dffdecf0$8361d4c2@pavelk">news:028e01c07fc1$dffdecf0$8361d4c2@pavelk...
  Hi Rick,
  you are not doing anything wrong. You just have to send the proper
  content-type depending on what you're outputing. For example if you want
 to
  produce a gif image you have to use header("Content-type: image/gif");
  There's nothing wrong with it as PHP can't predict what you want to do.
  text/html is set as default simply because it's the type most users in
 most
  cases need.

 Yes, I know that. But what I'm saying is that eg.

 ?php
 header("Content-type: text/vnd.wap.wml");
 ?
 wml
 card
 pHello world!/p
 /card
 /wml

 ...gets put out with a text/html content type as opposed to the specified
 text/vnd.wap.wml. Having said that, I just tried it on the linux machine
and
 it worked fine. A Windows thing?

 --
 Rick Hodger



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] WML/WAP and PHP

2001-01-16 Thread Chris Adams

On 16 Jan 2001 05:05:18 -0800, Rick Hodger [EMAIL PROTECTED] wrote:
Here's a fun little thing I discovered, possibly a bug in PHP itself?

To output a WAP page you must output a content-type header else the phone's
browser won't recognise the page. Dead simple. Use:

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

And all is well and good as long as you use echo/printf etc to output your
page. The second you deviate out of PHP and back to HTML the content-type
gets overwritten with a text/html, and so the page doesn't work.  ASP used
to be able to cope with this, is it a bug or something I'm doing wrong?

Hmmm - you might need to start checking details of your configuration. I've had
no problems doing a lot of WML work in PHP and it's always correctly returned
the content-type I've set using header on 4.0.3pl1 (OpenBSD) and 4.0.3 / 4.0.4
(Win32).

Do you have anything like output buffering turned on? I doubt that's causing
the problem as I use output buffering semi-frequently[0] but it can't hurt to
check.


[0] neat hack - use ob_content_length() to tell when you've output almost as
much data as the phone can handle (find this by doing a browser detect) so you
can stop looping over a recordset and emit the Next/Prev page headers instead).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]