How to echo raw post message using php://input
| From: | XiongWei | Date: | Tue, 03 Jun 2003 12:16:33 +0000 |
| Subject: | How to echo raw post message using php://input | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149943@lists.php.net to get a copy of this message | ||
Hi Everyone,
I wrote a routine "postrawdata.php" for displaying HTTP raw request message.
<?php
$putdata = fopen( "php://input" , "rb" );
while(!feof( $putdata ))
echo fread($putdata, 4096 );
fclose($putdata);
?>
It works properly when using a socket program to post something to it.
But submitting from a simple HTML below will make it dead, I have tested it under
IE 6.0 and Netscape 7.0 , any suggestion is appreciate.
<body>
<form name="form1" method="post" action="postrawdata.php">
<input type="text" name="name" >
<input type="submit" name="Submit" value="Submit">
</form>
</body>
Thanks,
Willaim Hong