faqts : Computers : Programming : Languages : PHP : Common Problems : HTTP Headers

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 31 people (45%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

How do I supress HTTP headers?

May 21st, 2001 17:25
Onno Benschop, Nigel Stewart, Ben Udall,


If you are running php from the command line you can use the -q option.
   php -q myFile.php3
If you are using it as a module or a cgi from within a server, then 
don't output any data.
If you wish to output foreign data, like an image directly from php you 
can just output using the header() function:
From the manual:
<?php
    Header("Content-type: image/gif");
    $string=implode($argv," ");
    $im = imagecreatefromgif("images/button1.gif");
    $orange = ImageColorAllocate($im, 220, 210, 60);
    $px = (imagesx($im)-7.5*strlen($string))/2;
    ImageString($im,3,$px,9,$string,$orange);
    ImageGif($im);
    ImageDestroy($im);
?>