Re: Problems with headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at xxxxxxx) in <b>xxxxxxx</b> on line <b>11</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at xxxxxx) in <b>xxxxxx</b> on line <b>12</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at xxxxxxx) in <b>/xxxxxxxx</b> on line <b>13</b><br />
<?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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux