Reply to URGENT: Prevent default HTTP headers from being sent

Your name:

Reply:


Posted by Lisa Pearlson on 06/28/05 08:37

Hi,

I have a php script with no more than this:

<?php echo "Hello World!"; ?>

When a webbrowser client requests data, it receives Apache server headers,
followed by my data:

HTTP/1.1 200 OK
Date: Tue, 28 Jun 2005 06:02:56 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b
DAV/1.0.2 PHP/4.1.2 mod_perl/1.26
X-Powered-By: PHP/4.1.2
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

c
Hello World!
0

=======================
QUESTIONS:
- Where do the 'c' and '0' come from? '0' just denoting the end of the data?
- How do I prevent HTTP headers sent back to the client? I wish to only send
"Hello World!", without any headers. The reason is that the client will be a
piece of hardware that expects binary data as response, not HTTP headers.
I don't think this can be done with PHP, as it is probably handled by
apache.
If so, can I use Apache's RewriteEngine to accomplish this, in case
User-Agent is "^MyThinHardware.*" ?
How can I keep Apache from sending these headers?
=======================

I use the following php script to simulate a client requesting the php page,
and display the headers:

$header = "POST $cgi HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "User-Agent: MyThinHardware/1.0\r\n";
$header .= "Content-Type: application/octet-stream\r\n";
$header .= "Content-Length: $size\r\n";
$header .= "Connection: close\r\n";
$header .= "\r\n";


/* post data */
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp) {
die("$errstr ($errno)");
}
else {
fwrite($fp, $header);
fwrite($fp, $data, $size);
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
}
echo $response;

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация