Re: [PHP] Problems with headers

2005-09-22 Thread Rasmus Lerdorf
Graham Anderson wrote:
 ?php
 $quote = \;
 $xml = '';
 $xml .= '?xml version=1.0?'.\n;
 $xml .= '?quicktime type=application/x-qtskin?'.\n;
 $xml .= 'skin'.\n;
 $xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote. 
 '/'.\n;
 $xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
 $quote.   '/'.\n;
 $xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.  
  '/'.\n;
 $xml .= '/skin';
 header('Content-Type: video/quicktime'); //took out a space
 header (Content-Length: .strlen($xml));  // added a space
 echo $xml;
 ?

Wow, that is nasty.  There is probably a syntax error in there.  Use a
heredoc in cases like this.  Something like this:

$xml =  EOB
?xml version=1.0?
?quicktime type=...
...
EOB;

Much less likely to make mistakes this way since you don't need to
escape anything (except $) and you can still use variables in the block
of text.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-22 Thread Stephen Leaf
On Thursday 22 September 2005 12:10 am, David Robley wrote:
Not sure if you can attach files however to make 100% sure I'm attaching a 
working copy of your script. I did modify it just a bit. However the code 
that you gave us initially worked flawlessly under CLI PHP.

 Graham Anderson wrote:
  I checked that too :(
  No spaces in the ?php line
  I am running PHP Version 4.4.0
 
  Out of curiosity, I removed the line:
  $xml .= '?quicktime type=application/x-qtskin?'.\n;
  and got the same error message
 
  Is this one of those situations for ob_start ?
  Kind of bizarre to my Newbie mind
 
  ?php
  $quote = \;
  $xml = '';
  $xml .= '?xml version=1.0?'.\n;
  $xml .= '?quicktime type=application/x-qtskin?'.\n;
  $xml .= 'skin'.\n;
  $xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.
  '/'.\n;
  $xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
  $quote.   '/'.\n;
  $xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.
'/'.\n;
  $xml .= '/skin';
  header('Content-Type: video/quicktime');
  header (Content-Length: .strlen($xml));
  echo $xml;
  ?
 
  I am still getting the :
  bWarning/b:  Cannot modify header information - headers already
  sent by (output started at
  /home/www/siren/siren/fonovisa/skintest/Library/php/
  fonovisa_simple.php:1) in
  b/home/www/siren/siren/fonovisa/skintest/Library/php/
  fonovisa_simple.php/b on line b12/bbr /

 Actually, I think it might be something quite unexpected. Try commenting
 out the two calls to header, then run the script and do a 'view source'. My
 guess is there is a syntax error message being output which will of course
 cause header to bleat. My second guess is that the syntax error will be
 caused by line 2 (but won't appear in that line)

 $quote = \;

 which may not be doing what you hope it is. The solution for this is left
 as an exercise for the student :-)

 Cheers
 --
 David Robley

 The most expensive component is the one that breaks.


a.php
Description: application/php
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Problems with headers

2005-09-22 Thread Graham Anderson

Thanks Rasmus :)
that is an incredibly cool tip: EOB
Surprised I did not see you at the Digital Rights [hollywood digital] 
conference in LA early this week.
Upside: Free sushi and an ocean view. Downside: Lots of 'agency' types 
and sales folk



when  I access a straight movie file with no php, fonovisa.mov, 
everything looks good when I curl it

HTTP/1.1 200 OK
Date: Thu, 22 Sep 2005 16:52:45 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0 FrontPage/5.0.2.2510
Last-Modified: Tue, 20 Sep 2005 17:58:39 GMT
ETag: 1b28dcc-e3-43304dcf
Accept-Ranges: bytes
Content-Length: 227
Content-Type: video/quicktime

* Connection #0 left intact
* Closing connection #0
?xml version=1.0?
?quicktime type=application/x-qtskin?
skin
movie src=../../fonovisa.mov/
contentregion src=../images/mask.gif/
dragregion src=../images/drag.gif/
/skin


If I use PHP to generate the same output, I get the error: can not 
modify the headers.
Could the file extension, .php, somehow be preventing the php script 
from outputting properly ?


?php
 $xml = EOB
?xml version=1.0?
?quicktime type=application/x-qtskin ?
skin
movie src=../../fonovisa.mov/
contentregion src=../images/mask.gif/
dragregion src=../images/drag.gif/
/skin
EOB;
header(Accept-Ranges: bytes);
header (Content-Length: .strlen($xml));
header('Content-Type: video/quicktime');
echo $xml;
?


The above php version gives me the below when I curl it
* About to connect() to www.siren.cc:80
* Connected to www.siren.cc (64.182.20.154) port 80
 GET /siren/fonovisa/skintest/Library/php/fonovisa_simplev2.php 
HTTP/1.1
User-Agent: curl/7.10.2 (powerpc-apple-darwin7.0) libcurl/7.10.2 
OpenSSL/0.9.7g zlib/1.1.4

Host: www.siren.cc
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

HTTP/1.1 200 OK
Date: Thu, 22 Sep 2005 17:01:17 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0 FrontPage/5.0.2.2510
X-Powered-By: PHP/4.4.0
Transfer-Encoding: chunked
Content-Type: text/html

br /
bWarning/b:  Cannot modify header information - headers already 
sent by (output started at xxx) in bxxx/b on line 
b11/bbr /

br /
bWarning/b:  Cannot modify header information - headers already 
sent by (output started at xx) in bxx/b on line 
b12/bbr /

br /
bWarning/b:  Cannot modify header information - headers already 
sent by (output started at xxx) in b//b on line 
b13/bbr /

?xml version=1.0?
?quicktime type=application/x-qtskin ?
skin
movie src=../../fonovisa.mov/
contentregion src=../images/mask.gif/
dragregion src=../images/drag.gif/
* Connection #0 left intact
* Closing connection #0
/skin

know what it could be ?

g




On Sep 22, 2005, at 5:18 AM, Rasmus Lerdorf wrote:


Graham Anderson wrote:

?php
$quote = \;
$xml = '';
$xml .= '?xml version=1.0?'.\n;
$xml .= '?quicktime type=application/x-qtskin?'.\n;
$xml .= 'skin'.\n;
$xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.
'/'.\n;
$xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
$quote.   '/'.\n;
$xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.
 '/'.\n;
$xml .= '/skin';
header('Content-Type: video/quicktime'); //took out a space
header (Content-Length: .strlen($xml));  // added a space
echo $xml;
?


Wow, that is nasty.  There is probably a syntax error in there.  Use a
heredoc in cases like this.  Something like this:

$xml =  EOB
?xml version=1.0?
?quicktime type=...
...
EOB;

Much less likely to make mistakes this way since you don't need to
escape anything (except $) and you can still use variables in the block
of text.

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-22 Thread Rasmus Lerdorf
Graham Anderson wrote:
 Thanks Rasmus :)
 that is an incredibly cool tip: EOB
 Surprised I did not see you at the Digital Rights [hollywood digital]
 conference in LA early this week.
 Upside: Free sushi and an ocean view. Downside: Lots of 'agency' types
 and sales folk
 
 
 when  I access a straight movie file with no php, fonovisa.mov,
 everything looks good when I curl it
 HTTP/1.1 200 OK
 Date: Thu, 22 Sep 2005 16:52:45 GMT
 Server: Apache/1.3.33 (Unix) PHP/4.4.0 FrontPage/5.0.2.2510
 Last-Modified: Tue, 20 Sep 2005 17:58:39 GMT
 ETag: 1b28dcc-e3-43304dcf
 Accept-Ranges: bytes
 Content-Length: 227
 Content-Type: video/quicktime
 
 * Connection #0 left intact
 * Closing connection #0
 ?xml version=1.0?
 ?quicktime type=application/x-qtskin?
 skin
 movie src=../../fonovisa.mov/
 contentregion src=../images/mask.gif/
 dragregion src=../images/drag.gif/
 /skin
 
 
 If I use PHP to generate the same output, I get the error: can not
 modify the headers.
 Could the file extension, .php, somehow be preventing the php script
 from outputting properly ?

Do this:

od -c filename.php

And send us the output.  If it is really long, put it online somewhere.
 You have a stray carriage return or some other weird character in there
somewhere.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-22 Thread Graham Anderson

Ok, I think I figured it out .

I had to convert my BBedit text editor file to plain text and then 
copy/paste that text directly into a new  server text file

So, I guess my $100+ text editor is screwing up the file ?
Is there some way to prevent this ?

My text encoding is in UTF-8 because I have been working with non-Latin 
languages of late...
Is there some bullet proof way to prevent this...or some filtering 
script I should run ?

These 3 ?'s do not appear in BBedit file when I turn invisibles on...
I am working in OS X.


This is the output from my  BBedit [my text editor]  file on the 
server, my main text editor

Notice the 3 Question Marks at the beginning

000   ?   ?   ?  ?   p   h   p  \n   $   x   m   l   =
020E   O   B  \n  ?   x   m   l   v   e
040   r   s   i   o   n   =  1   .   0  ? \n  ?
060   q   u   i   c   k   t   i   m   e   t   y   p   e   =   
100   a   p   p   l   i   c   a   t   i   o   n   /   x   -   q   t
120   s   k   i   n  ? \n  s   k   i   n \n   
140   m   o   v   i   e   s   r   c   =  .   .   /   .   .
160   /   f   o   n   o   v   i   s   a   .   m   o   v  /   
200  \n  c   o   n   t   e   n   t   r   e   g   i   o   n
220   s   r   c   =  .   .   /   i   m   a   g   e   s   /   m
240   a   s   k   .   g   i   f  / \n  d   r   a   g
260   r   e   g   i   o   n   s   r   c   =  .   .   /   i
300   m   a   g   e   s   /   d   r   a   g   .   g   i   f  /
320 \n  /   s   k   i   n \n   E   O   B   ;  \n   h
340   e   a   d   e   r   (  A   c   c   e   p   t   -   R   a
360   n   g   e   s   :   b   y   t   e   s  )   ;  \n   h
400   e   a   d   e   r   (  C   o   n   t   e   n   t   -
420   L   e   n   g   t   h   :  .   s   t   r   l   e   n
440   (   $   x   m   l   )   )   ;  \n   h   e   a   d   e   r   (
460   '   C   o   n   t   e   n   t   -   T   y   p   e   :   v
500   i   d   e   o   /   q   u   i   c   k   t   i   m   e   '   )
520   ;  \n   e   c   h   o   $   x   m   l   ;  \n   ? \n
540

the script is encoded as utf-8 in BBedit



fonovisa_simplev2.php
Description: application/php





Plain Text File output
The plain text version does output properly :)
If I od-c the the plain text, I do not get the 3 Question Marks at the 
beginning


000  ?   p   h   p  \n   $   x   m   l   =  
020  E   O   B  \n  ?   x   m   l   v   e   r   s   i
040   o   n   =  1   .   0  ? \n  ?   q   u   i
060   c   k   t   i   m   e   t   y   p   e   =  a   p   p
100   l   i   c   a   t   i   o   n   /   x   -   q   t   s   k   i
120   n  ? \n  s   k   i   n \n  m   o   v
140   i   e   s   r   c   =  .   .   /   .   .   /   f   o
160   n   o   v   i   s   a   .   m   o   v  / \n  c
200   o   n   t   e   n   t   r   e   g   i   o   n   s   r   c
220   =  .   .   /   i   m   a   g   e   s   /   m   a   s   k
240   .   g   i   f  / \n  d   r   a   g   r   e   g
260   i   o   n   s   r   c   =  .   .   /   i   m   a   g
300   e   s   /   d   r   a   g   .   g   i   f  / \n   
320   /   s   k   i   n \n   E   O   B   ;  \n   h   e   a   d
340   e   r   (  A   c   c   e   p   t   -   R   a   n   g   e
360   s   :   b   y   t   e   s  )   ;  \n   h   e   a   d
400   e   r   (  C   o   n   t   e   n   t   -   L   e   n
420   g   t   h   :  .   s   t   r   l   e   n   (   $   x
440   m   l   )   )   ;  \n   h   e   a   d   e   r   (   '   C   o
460   n   t   e   n   t   -   T   y   p   e   :   v   i   d   e
500   o   /   q   u   i   c   k   t   i   m   e   '   )   ;  \n   e
520   c   h   o   $   x   m   l   ;  \n   ?   
534


many thanks :)
g

On Sep 22, 2005, at 10:15 AM, Rasmus Lerdorf wrote:


Graham Anderson wrote:

Thanks Rasmus :)
that is an incredibly cool tip: EOB
Surprised I did not see you at the Digital Rights [hollywood digital]
conference in LA early this week.
Upside: Free sushi and an ocean view. Downside: Lots of 'agency' types
and sales folk


when  I access a straight movie file with no php, fonovisa.mov,
everything looks good when I curl it
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2005 16:52:45 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0 FrontPage/5.0.2.2510
Last-Modified: Tue, 20 Sep 2005 17:58:39 GMT
ETag: 1b28dcc-e3-43304dcf
Accept-Ranges: bytes
Content-Length: 227
Content-Type: video/quicktime

* Connection #0 left intact
* Closing connection #0
?xml version=1.0?
?quicktime type=application/x-qtskin?
skin
movie src=../../fonovisa.mov/
contentregion src=../images/mask.gif/
dragregion src=../images/drag.gif/
/skin


If I use PHP 

Re: [PHP] Problems with headers

2005-09-22 Thread Rasmus Lerdorf
Graham Anderson wrote:
 Ok, I think I figured it out .
 
 I had to convert my BBedit text editor file to plain text and then
 copy/paste that text directly into a new  server text file
 So, I guess my $100+ text editor is screwing up the file ?
 Is there some way to prevent this ?

Tell your editor to not send a BOM.  If it won't let you configure that,
throw it away.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-22 Thread Jim Jagielski
Set BBEdit to use Mac OS Roman. From the main window, choose
the file icon (5th from left).

Graham Anderson wrote:
 
 --Apple-Mail-15-928383921
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
   charset=US-ASCII;
   format=flowed
 
 Ok, I think I figured it out .
 
 I had to convert my BBedit text editor file to plain text and then 
 copy/paste that text directly into a new  server text file
 So, I guess my $100+ text editor is screwing up the file ?
 Is there some way to prevent this ?
 
 My text encoding is in UTF-8 because I have been working with non-Latin 
 languages of late...
 Is there some bullet proof way to prevent this...or some filtering 
 script I should run ?
 These 3 ?'s do not appear in BBedit file when I turn invisibles on...
 I am working in OS X.
 
 
 This is the output from my  BBedit [my text editor]  file on the 
 server, my main text editor
 Notice the 3 Question Marks at the beginning
 
 000   ?   ?   ?  ?   p   h   p  \n   $   x   m   l   =
 020E   O   B  \n  ?   x   m   l   v   e
 040   r   s   i   o   n   =  1   .   0  ? \n  ?
 060   q   u   i   c   k   t   i   m   e   t   y   p   e   =   
 100   a   p   p   l   i   c   a   t   i   o   n   /   x   -   q   t
 120   s   k   i   n  ? \n  s   k   i   n \n   
 140   m   o   v   i   e   s   r   c   =  .   .   /   .   .
 160   /   f   o   n   o   v   i   s   a   .   m   o   v  /   
 200  \n  c   o   n   t   e   n   t   r   e   g   i   o   n
 220   s   r   c   =  .   .   /   i   m   a   g   e   s   /   m
 240   a   s   k   .   g   i   f  / \n  d   r   a   g
 260   r   e   g   i   o   n   s   r   c   =  .   .   /   i
 300   m   a   g   e   s   /   d   r   a   g   .   g   i   f  /
 320 \n  /   s   k   i   n \n   E   O   B   ;  \n   h
 340   e   a   d   e   r   (  A   c   c   e   p   t   -   R   a
 360   n   g   e   s   :   b   y   t   e   s  )   ;  \n   h
 400   e   a   d   e   r   (  C   o   n   t   e   n   t   -
 420   L   e   n   g   t   h   :  .   s   t   r   l   e   n
 440   (   $   x   m   l   )   )   ;  \n   h   e   a   d   e   r   (
 460   '   C   o   n   t   e   n   t   -   T   y   p   e   :   v
 500   i   d   e   o   /   q   u   i   c   k   t   i   m   e   '   )
 520   ;  \n   e   c   h   o   $   x   m   l   ;  \n   ? \n
 540
 
 the script is encoded as utf-8 in BBedit
 
 
 --Apple-Mail-15-928383921
 Content-Transfer-Encoding: quoted-printable
 Content-Type: application/x-php;
   x-mac-type=54455854;
   x-unix-mode=0644;
   x-mac-creator=522A6368;
   name=fonovisa_simplev2.php
 Content-Disposition: attachment;
   filename=fonovisa_simplev2.php
 
 =EF=BB=BF?php=0A=20$xml=20=3D=20EOB=0A?xml=20version=3D1.0?=0A=
 ?quicktime=20type=3Dapplication/x-qtskin?=0Askin=0Amovie=20=
 src=3D../../fonovisa.mov/=0Acontentregion=20=
 src=3D../images/mask.gif/=0Adragregion=20src=3D../images/drag.gif/=0A=
 /skin=0AEOB;=0Aheader(Accept-Ranges:=20bytes);=0Aheader=20=
 (Content-Length:=20.strlen($xml));=0Aheader('Content-Type:=20=
 video/quicktime');=0Aecho=20$xml;=0A?=0A=
 
 --Apple-Mail-15-928383921
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
   charset=US-ASCII;
   format=flowed
 
 
 
 
 
 Plain Text File output
 The plain text version does output properly :)
 If I od-c the the plain text, I do not get the 3 Question Marks at the 
 beginning
 
 000  ?   p   h   p  \n   $   x   m   l   =  
 020  E   O   B  \n  ?   x   m   l   v   e   r   s   i
 040   o   n   =  1   .   0  ? \n  ?   q   u   i
 060   c   k   t   i   m   e   t   y   p   e   =  a   p   p
 100   l   i   c   a   t   i   o   n   /   x   -   q   t   s   k   i
 120   n  ? \n  s   k   i   n \n  m   o   v
 140   i   e   s   r   c   =  .   .   /   .   .   /   f   o
 160   n   o   v   i   s   a   .   m   o   v  / \n  c
 200   o   n   t   e   n   t   r   e   g   i   o   n   s   r   c
 220   =  .   .   /   i   m   a   g   e   s   /   m   a   s   k
 240   .   g   i   f  / \n  d   r   a   g   r   e   g
 260   i   o   n   s   r   c   =  .   .   /   i   m   a   g
 300   e   s   /   d   r   a   g   .   g   i   f  / \n   
 320   /   s   k   i   n \n   E   O   B   ;  \n   h   e   a   d
 340   e   r   (  A   c   c   e   p   t   -   R   a   n   g   e
 360   s   :   b   y   t   e   s  )   ;  \n   h   e   a   d
 400   e   r   (  C   o   n   t   e   n   t   -   L   e   n
 420   g   t   h   :  .   s   t   r   l   e   n   (   $   x
 440   m   l   )   )   ;  \n   h   e   a   d   e   r   (   '   C   o
 460   n   t   e   n   t   -   T  

Re: [PHP] Problems with headers

2005-09-22 Thread Graham Anderson

thanks guys :)

encoding in  utf-8 NO BOM seems to do the trick


g


On Sep 22, 2005, at 11:05 AM, Jim Jagielski wrote:


Set BBEdit to use Mac OS Roman. From the main window, choose
the file icon (5th from left).

Graham Anderson wrote:


--Apple-Mail-15-928383921
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed

Ok, I think I figured it out .

I had to convert my BBedit text editor file to plain text and then
copy/paste that text directly into a new  server text file
So, I guess my $100+ text editor is screwing up the file ?
Is there some way to prevent this ?

My text encoding is in UTF-8 because I have been working with  
non-Latin

languages of late...
Is there some bullet proof way to prevent this...or some filtering
script I should run ?
These 3 ?'s do not appear in BBedit file when I turn invisibles on...
I am working in OS X.


This is the output from my  BBedit [my text editor]  file on the
server, my main text editor
Notice the 3 Question Marks at the beginning

000   ?   ?   ?  ?   p   h   p  \n   $   x   m   l
=
020E   O   B  \n  ?   x   m   l   v
e
040   r   s   i   o   n   =  1   .   0  ? \n   
?
060   q   u   i   c   k   t   i   m   e   t   y   p   e   =

100   a   p   p   l   i   c   a   t   i   o   n   /   x   -   q
t
120   s   k   i   n  ? \n  s   k   i   n \n

140   m   o   v   i   e   s   r   c   =  .   .   /   .
.
160   /   f   o   n   o   v   i   s   a   .   m   o   v  /


200  \n  c   o   n   t   e   n   t   r   e   g   i   o   n
220   s   r   c   =  .   .   /   i   m   a   g   e   s   /
m
240   a   s   k   .   g   i   f  / \n  d   r   a
g
260   r   e   g   i   o   n   s   r   c   =  .   .   /
i
300   m   a   g   e   s   /   d   r   a   g   .   g   i   f   
/
320 \n  /   s   k   i   n \n   E   O   B   ;  \n
h
340   e   a   d   e   r   (  A   c   c   e   p   t   -   R
a
360   n   g   e   s   :   b   y   t   e   s  )   ;  \n
h
400   e   a   d   e   r   (  C   o   n   t   e   n   t
-
420   L   e   n   g   t   h   :  .   s   t   r   l   e
n
440   (   $   x   m   l   )   )   ;  \n   h   e   a   d   e   r
(
460   '   C   o   n   t   e   n   t   -   T   y   p   e   :
v
500   i   d   e   o   /   q   u   i   c   k   t   i   m   e   '
)
520   ;  \n   e   c   h   o   $   x   m   l   ;  \n   ?  
\n

540

the script is encoded as utf-8 in BBedit


--Apple-Mail-15-928383921
Content-Transfer-Encoding: quoted-printable
Content-Type: application/x-php;
x-mac-type=54455854;
x-unix-mode=0644;
x-mac-creator=522A6368;
name=fonovisa_simplev2.php
Content-Disposition: attachment;
filename=fonovisa_simplev2.php

=EF=BB=BF?php=0A=20$xml=20=3D=20EOB=0A?xml=20version=3D1.0? 
=0A=

?quicktime=20type=3Dapplication/x-qtskin?=0Askin=0Amovie=20=
src=3D../../fonovisa.mov/=0Acontentregion=20=
src=3D../images/mask.gif/=0Adragregion=20src=3D../images/ 
drag.gif/=0A=

/skin=0AEOB;=0Aheader(Accept-Ranges:=20bytes);=0Aheader=20=
(Content-Length:=20.strlen($xml));=0Aheader('Content-Type:=20=
video/quicktime');=0Aecho=20$xml;=0A?=0A=

--Apple-Mail-15-928383921
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed





Plain Text File output
The plain text version does output properly :)
If I od-c the the plain text, I do not get the 3 Question Marks at the
beginning

000  ?   p   h   p  \n   $   x   m   l   =   

020  E   O   B  \n  ?   x   m   l   v   e   r   s
i
040   o   n   =  1   .   0  ? \n  ?   q   u
i
060   c   k   t   i   m   e   t   y   p   e   =  a   p
p
100   l   i   c   a   t   i   o   n   /   x   -   q   t   s   k
i
120   n  ? \n  s   k   i   n \n  m   o
v
140   i   e   s   r   c   =  .   .   /   .   .   /   f
o
160   n   o   v   i   s   a   .   m   o   v  / \n   
c
200   o   n   t   e   n   t   r   e   g   i   o   n   s   r
c
220   =  .   .   /   i   m   a   g   e   s   /   m   a   s
k
240   .   g   i   f  / \n  d   r   a   g   r   e
g
260   i   o   n   s   r   c   =  .   .   /   i   m   a
g
300   e   s   /   d   r   a   g   .   g   i   f  / \n

320   /   s   k   i   n \n   E   O   B   ;  \n   h   e   a
d
340   e   r   (  A   c   c   e   p   t   -   R   a   n   g
e
360   s   :   b   y   t   e   s  )   ;  \n   h   e   a
d
400   e   r   (  C   o   n   t   e   n   t   -   L   e
n
420   g   t   h   :  .   s   t   r   l   e   n   

[PHP] Problems with headers

2005-09-21 Thread Graham Anderson

I am trying to get  headers  to output properly

Even though I am defining Content-type as 'video/quicktime' , the  
output is still text/html

Also, Content-Length is not outputting properly  either :(

On the positive side, It appears to be outputting the $xml string  
correctly, but screws up on the headers

How do I fix this ?


many thanks in advance


with the below script:
?php
$quote = \;
$xml = '';
$xml .= '?xml version=1.0?'.\n;
$xml .= '?quicktime type=application/x-qtskin?'.\n;
$xml .= 'skin'.\n;
$xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.  
'/'.\n;
$xml .= 'contentregion src=' .$quote.  ../images/mask.gif . 
$quote.   '/'.\n;
$xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.   
 '/'.\n;

$xml .= '/skin';

header('Content-Type:  video/quicktime');
header (Content-Length:.strlen($xml));
echo $xml;
?


I am getting the below errors by curl'ing the php script.
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2005 02:03:24 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0 FrontPage/5.0.2.2510
X-Powered-By: PHP/4.4.0
Transfer-Encoding: chunked
Content-Type: text/html

br /
bWarning/b:  Cannot modify header information - headers already  
sent by (output started at  
/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php:1) in  
b/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php/b on line b11/bbr /

br /
bWarning/b:  Cannot modify header information - headers already  
sent by (output started at  
/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php:1) in  
b/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php/b on line b12/bbr /

?xml version=1.0?
?quicktime type=application/x-qtskin?
skin
movie src=../../fonovisa.mov/
contentregion src=../images/mask.gif/
dragregion src=../images/drag.gif/
* Connection #0 left intact
* Closing connection #0
/skin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-21 Thread Chris Shiflett

Graham Anderson wrote:

Even though I am defining Content-type as 'video/quicktime',
the output is still text/html
Also, Content-Length is not outputting properly either :(


[snip]


header('Content-Type:  video/quicktime');
header (Content-Length:.strlen($xml));


You have a superfluous space in your Content-Type header, and you're 
missing a space in your Content-Length header.


Those two need to share. :-)

Your other error is due to output being generated prior to the header() 
calls.


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-21 Thread Graham Anderson

thanks Chris :)

I changed the spaces but am still getting the same output errors:
bWarning/b:  Cannot modify header information - headers already  
sent by (output started at  
/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php:1) in  
b/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php/b on line b11/bbr /

br /
bWarning/b:  Cannot modify header information - headers already  
sent by (output started at  
/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php:1) in  
b/home/www/siren/siren/fonovisa/skintest/Library/php/ 
fonovisa_simple.php/b on line b12/bbr /


Because I am echoing the $xml string AFTER the header info, I would  
assume the headers would work ?

Is there some way to ensure that the headers come first ?

many thanks
g

?php
$quote = \;
$xml = '';
$xml .= '?xml version=1.0?'.\n;
$xml .= '?quicktime type=application/x-qtskin?'.\n;
$xml .= 'skin'.\n;
$xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.  
'/'.\n;
$xml .= 'contentregion src=' .$quote.  ../images/mask.gif . 
$quote.   '/'.\n;
$xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.   
 '/'.\n;

$xml .= '/skin';
header('Content-Type: video/quicktime'); //took out a space
header (Content-Length: .strlen($xml));  // added a space
echo $xml;
?

On Sep 21, 2005, at 7:25 PM, Chris Shiflett wrote:


Graham Anderson wrote:

Even though I am defining Content-type as 'video/quicktime',
the output is still text/html
Also, Content-Length is not outputting properly either :(


[snip]


header('Content-Type:  video/quicktime');
header (Content-Length:.strlen($xml));


You have a superfluous space in your Content-Type header, and you're  
missing a space in your Content-Length header.


Those two need to share. :-)

Your other error is due to output being generated prior to the  
header() calls.


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-21 Thread Stephen Leaf
On Wednesday 21 September 2005 09:34 pm, Graham Anderson wrote:
it doesn't look like there is anything wrong with your code. what you might 
check however is, is there a space or a newline before ?php
_nothing_ should come before ?php


 thanks Chris :)

 I changed the spaces but am still getting the same output errors:
 bWarning/b:  Cannot modify header information - headers already
 sent by (output started at
 /home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php:1) in
 b/home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php/b on line b11/bbr /
 br /
 bWarning/b:  Cannot modify header information - headers already
 sent by (output started at
 /home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php:1) in
 b/home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php/b on line b12/bbr /

 Because I am echoing the $xml string AFTER the header info, I would
 assume the headers would work ?
 Is there some way to ensure that the headers come first ?

 many thanks
 g

 ?php
 $quote = \;
 $xml = '';
 $xml .= '?xml version=1.0?'.\n;
 $xml .= '?quicktime type=application/x-qtskin?'.\n;
 $xml .= 'skin'.\n;
 $xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.
 '/'.\n;
 $xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
 $quote.   '/'.\n;
 $xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.
   '/'.\n;
 $xml .= '/skin';
 header('Content-Type: video/quicktime'); //took out a space
 header (Content-Length: .strlen($xml));  // added a space
 echo $xml;
 ?

 On Sep 21, 2005, at 7:25 PM, Chris Shiflett wrote:
  Graham Anderson wrote:
  Even though I am defining Content-type as 'video/quicktime',
  the output is still text/html
  Also, Content-Length is not outputting properly either :(
 
  [snip]
 
  header('Content-Type:  video/quicktime');
  header (Content-Length:.strlen($xml));
 
  You have a superfluous space in your Content-Type header, and you're
  missing a space in your Content-Length header.
 
  Those two need to share. :-)
 
  Your other error is due to output being generated prior to the
  header() calls.
 
  Hope that helps.
 
  Chris
 
  --
  Chris Shiflett
  Brain Bulb, The PHP Consultancy
  http://brainbulb.com/
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-21 Thread Graham Anderson

I checked that too :(
No spaces in the ?php line
I am running PHP Version 4.4.0

Out of curiosity, I removed the line:
$xml .= '?quicktime type=application/x-qtskin?'.\n;
and got the same error message

Is this one of those situations for ob_start ?
Kind of bizarre to my Newbie mind

?php
$quote = \;
$xml = '';
$xml .= '?xml version=1.0?'.\n;
$xml .= '?quicktime type=application/x-qtskin?'.\n;
$xml .= 'skin'.\n;
$xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote. 
'/'.\n;
$xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
$quote.   '/'.\n;
$xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.  
 '/'.\n;

$xml .= '/skin';
header('Content-Type: video/quicktime');
header (Content-Length: .strlen($xml));
echo $xml;
?


I am still getting the :

bWarning/b:  Cannot modify header information - headers already
sent by (output started at
/home/www/siren/siren/fonovisa/skintest/Library/php/
fonovisa_simple.php:1) in
b/home/www/siren/siren/fonovisa/skintest/Library/php/
fonovisa_simple.php/b on line b12/bbr /




On Sep 21, 2005, at 7:46 PM, Stephen Leaf wrote:


On Wednesday 21 September 2005 09:34 pm, Graham Anderson wrote:
it doesn't look like there is anything wrong with your code. what you 
might

check however is, is there a space or a newline before ?php
_nothing_ should come before ?php



thanks Chris :)

I changed the spaces but am still getting the same output errors:
bWarning/b:  Cannot modify header information - headers already
sent by (output started at
/home/www/siren/siren/fonovisa/skintest/Library/php/
fonovisa_simple.php:1) in
b/home/www/siren/siren/fonovisa/skintest/Library/php/
fonovisa_simple.php/b on line b11/bbr /
br /
bWarning/b:  Cannot modify header information - headers already
sent by (output started at
/home/www/siren/siren/fonovisa/skintest/Library/php/
fonovisa_simple.php:1) in
b/home/www/siren/siren/fonovisa/skintest/Library/php/
fonovisa_simple.php/b on line b12/bbr /

Because I am echoing the $xml string AFTER the header info, I would
assume the headers would work ?
Is there some way to ensure that the headers come first ?

many thanks
g

?php
$quote = \;
$xml = '';
$xml .= '?xml version=1.0?'.\n;
$xml .= '?quicktime type=application/x-qtskin?'.\n;
$xml .= 'skin'.\n;
$xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.
'/'.\n;
$xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
$quote.   '/'.\n;
$xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.
  '/'.\n;
$xml .= '/skin';
header('Content-Type: video/quicktime'); //took out a space
header (Content-Length: .strlen($xml));  // added a space
echo $xml;
?

On Sep 21, 2005, at 7:25 PM, Chris Shiflett wrote:

Graham Anderson wrote:

Even though I am defining Content-type as 'video/quicktime',
the output is still text/html
Also, Content-Length is not outputting properly either :(


[snip]


header('Content-Type:  video/quicktime');
header (Content-Length:.strlen($xml));


You have a superfluous space in your Content-Type header, and you're
missing a space in your Content-Length header.

Those two need to share. :-)

Your other error is due to output being generated prior to the
header() calls.

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-21 Thread Chris Shiflett

Graham Anderson wrote:
 No spaces in the ?php line

I think the problem is a line before the ?php line:

 bWarning/b:  Cannot modify header information - headers
 already sent by (output started at
 /home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php:1) in
 b/home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php/b on line b12/bbr /

Applying this to the code you've shown us, I get the following line numbers:

 1.
 2.  ?php
 3.  $quote = \;
 4.  $xml = '';
 5.  $xml .= '?xml version=1.0?' . \n;
 6.  $xml .= '?quicktime type=application/x-qtskin?' . \n;
 7.  $xml .= 'skin' . \n;
 8.  $xml .= 'movie src=' . $quote . ../../fonovisa.mov . $quote
 . '/' . \n;
 9.  $xml .= 'contentregion src=' . $quote . ../images/mask.gif .
 $quote . '/' . \n;
 10. $xml .= 'dragregion src=' . $quote . ../images/drag.gif .
 $quote . '/' . \n;
 11. $xml .= '/skin';
 12. header('Content-Type: video/quicktime');
 13. header(Content-Length: .strlen($xml));
 14. echo $xml;
 15. ?

If I'm right, then the problem is that you have output prior to calling 
the header() function, exactly as the error says. Remove the first line, 
and your problem might go away.


By the way, it's unnecessary to make your strings that hard to read - 
variables are interpreted in double-quoted strings, and double quotes 
don't need to be escaped inside single-quoted strings. For example:


8.  $xml .= 'movie src=../../fonovisa.mov /' . \n;

or

8.  $xml .= movie src=\../../fonovisa.mov\ /\n;

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with headers

2005-09-21 Thread David Robley
Graham Anderson wrote:

 I checked that too :(
 No spaces in the ?php line
 I am running PHP Version 4.4.0
 
 Out of curiosity, I removed the line:
 $xml .= '?quicktime type=application/x-qtskin?'.\n;
 and got the same error message
 
 Is this one of those situations for ob_start ?
 Kind of bizarre to my Newbie mind
 
 ?php
 $quote = \;
 $xml = '';
 $xml .= '?xml version=1.0?'.\n;
 $xml .= '?quicktime type=application/x-qtskin?'.\n;
 $xml .= 'skin'.\n;
 $xml .= 'movie src=' . $quote.   ../../fonovisa.mov .  $quote.
 '/'.\n;
 $xml .= 'contentregion src=' .$quote.  ../images/mask.gif .
 $quote.   '/'.\n;
 $xml .= 'dragregion src=' .  $quote. ../images/drag.gif .   $quote.
   '/'.\n;
 $xml .= '/skin';
 header('Content-Type: video/quicktime');
 header (Content-Length: .strlen($xml));
 echo $xml;
 ?
 
 
 I am still getting the :
 bWarning/b:  Cannot modify header information - headers already
 sent by (output started at
 /home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php:1) in
 b/home/www/siren/siren/fonovisa/skintest/Library/php/
 fonovisa_simple.php/b on line b12/bbr /

Actually, I think it might be something quite unexpected. Try commenting out
the two calls to header, then run the script and do a 'view source'. My
guess is there is a syntax error message being output which will of course
cause header to bleat. My second guess is that the syntax error will be
caused by line 2 (but won't appear in that line)

$quote = \;

which may not be doing what you hope it is. The solution for this is left as
an exercise for the student :-)

Cheers
-- 
David Robley

The most expensive component is the one that breaks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problems with headers and downloading file

2004-11-29 Thread Christian Johansson
Hello.

 

I have a problem with downloads with the use of header()

I have this code at the start at the download site:

 

Header(Content-Type: application/download);

Header(Content-Disposition: attachment; filename=export.txt);

 

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.

Is there some way to take control on what should be written to the file?

I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.

Anyone who can help me?

 

I can't store a file on the server, and then download it, because of some
government rules.

 

 

 

Regards

 

Christian Johansson

 



Re: [PHP] Problems with headers and downloading file

2004-11-29 Thread John Nichel
Christian Johansson wrote:
Hello.
 

I have a problem with downloads with the use of header()
I have this code at the start at the download site:
 

Header(Content-Type: application/download);
Header(Content-Disposition: attachment; filename=export.txt);
 

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.
Is there some way to take control on what should be written to the file?
I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.
Anyone who can help me?
 

I can't store a file on the server, and then download it, because of some
government rules.
http://us4.php.net/striptags
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problems with headers and downloading file

2004-11-29 Thread David Dickson
Christian Johansson wrote:
I have a problem with downloads with the use of header()
I have this code at the start at the download site:
 
Header(Content-Type: application/download); 
Header(Content-Disposition: attachment; filename=export.txt);  

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.
Is there some way to take control on what should be written to the file?
I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.
Christian Johansson
Anything you echo after sending the headers will be inserted into the 
downloaded file. For example:

?php
header(Content-Type: application/download);
header(Content-Disposition: attachment; filename=export.txt);
echo This is the first line\n;
echo This is the second line.;
?
Will cause the users browser to download a text document that contains 
two lines of text. All you need to do is write your php code after the 
headers that generates your text file contents.

-- David Dickson
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problems with headers in redirect

2001-11-13 Thread Richard Black

Hi, I'm hoping someone can help me with this one...

I'm doing redirects to various types of file (Flash, Office, DWF etc) and 
have found a problem with IE5.

I pass the script a document ID, and it retrieves the document record from 
a database, which stores the location of the file on the web server, and 
redirects the browser to the document.

What happens is that the browser gets redirected, but doesn't get the 
content-type header, and subsequently can't display the document.

Until yesterday I was using javascript redirection, which worked fine. 
However for other reasons (ie that didn't work with IE 5.5 or IE6) I had to 
change to using the header(Location: ) way.

Only work around I can see is to do the redirection based on browser type 
(i.e. one way for IE5, the other for IE5.5/IE6) but thats messy.

Any other ideas???

Richy

-- 
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] Problems with headers in redirect

2001-11-13 Thread John Steele

Hi Richy,

  Try sending the content header before the location header:

header(Content-type: image/jpeg);
header(Location: http://yourhost.com/yourfile.jpg;);

HTH,
  John

Hi, I'm hoping someone can help me with this one...

I'm doing redirects to various types of file (Flash, Office, DWF etc) and 
have found a problem with IE5.

I pass the script a document ID, and it retrieves the document record from 
a database, which stores the location of the file on the web server, and 
redirects the browser to the document.

What happens is that the browser gets redirected, but doesn't get the 
content-type header, and subsequently can't display the document.

Until yesterday I was using javascript redirection, which worked fine. 
However for other reasons (ie that didn't work with IE 5.5 or IE6) I had to 
change to using the header(Location: ) way.

Only work around I can see is to do the redirection based on browser type 
(i.e. one way for IE5, the other for IE5.5/IE6) but thats messy.

Any other ideas???

Richy

--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [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]