Re: Problems with headers

From: Date: Thu, 22 Sep 2005 05:07:58 +0000
Subject: Re: Problems with headers
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-222969@lists.php.net to get a copy of this message
Graham Anderson wrote:
No spaces in the <?php line
I think the problem is a line before the <?php line:
<b>Warning</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 <b>12</b><br />
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/

« previous php.general (#222969) next »