Re: Headers - returning specified HTTP headers from a POST
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Headers - returning specified HTTP headers from a POST

From: Tim Roberts <timr@probo.com>
Date: Thu Aug 11 2005 - 07:19:49 CEST

"John Smith" <johnsmith@theweather.com.au> wrote:
>
>Here's some static code which replicates the problem:
>
><?php
>header( "HTTP/1.1 200 OK\r\n" );
>header( "Content-type:text/plain\r\n" );
>header( "Content-length:3\r\n" );
>header( "\r\n" );
>header( "OK \n" );
>exit;
>?>

Couple of problems. First, Apache will add the HTTP header, not you.
Next, each call to header() gets its own newline -- you don't provide it.
Next, "OK" is not a header, it is the body. This will do what you want:

===== cut here =====
<?php
header( "Content-type:text/plain" );
?>
OK
===== cut here =====

-- 
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.
Received on Mon Oct 24 02:09:21 2005