Welcome Guest, Not a member yet? Register   Sign In
Header Errors
#1

[eluser]Eric Brown[/eluser]
I'm trying to output a pixel to the screen but I'm getting header errors. Here's my code.

Code:
$this->output->set_header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
            $this->output->set_header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
            #    # write out pertinent headers to let the browser know
            #    # that we're delivering a 43-byte GIF image
            $this->output->set_header("Content-type: image/gif");
            $this->output->set_header("Content-length: 43");
            #    # write one-pixel wide tranparent GIF to the output
            #    # stream
            
            $fp=fopen("php://memory","wb");
            fwrite($fp,"GIF89a\x01\x00\x01\x00\x80\x00\x00\xFF\xFF",15);
            fwrite($fp,"\xFF\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00",12);
            fwrite($fp,"\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02",12);
            fwrite($fp,"\x44\x01\x00\x3B",4);
            fclose($fp);


So I'm wondering how I can take the contents of the pixel stream and append them to the CI output as it appears that is executing at some point later.

What method forces the output to the browser so I can push the headers out before the image stream?




Theme © iAndrew 2016 - Forum software by © MyBB