469,266 Members | 1,768 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,266 developers. It's quick & easy.

how to use php://input?

I tried using php://input in the following script but nothing is output
when I run it:

<form action="test.php" method="post">
<input type="text" value="demo" />
<input type="submit" />
</form>
<?php
$fp = fopen('php://input','r');
while (!feof($fp))
echo fgets($fp);
fclose($fp);
?>

Any ideas as to what's being done wrong?

Jun 3 '06 #1
5 38107
yawnmoth wrote:
I tried using php://input in the following script but nothing is output
when I run it:

<form action="test.php" method="post">
<input type="text" value="demo" />


You're missing the name here.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jun 3 '06 #2

R. Rajesh Jeba Anbiah wrote:
yawnmoth wrote:
I tried using php://input in the following script but nothing is output
when I run it:

<form action="test.php" method="post">
<input type="text" value="demo" />


You're missing the name here.

Didn't notice that - thanks! :)

Jun 3 '06 #3

yawnmoth wrote:
I tried using php://input in the following script but nothing is output
when I run it:

<form action="test.php" method="post">
<input type="text" value="demo" />
<input type="submit" />
</form>
<?php
$fp = fopen('php://input','r');
while (!feof($fp))
echo fgets($fp);
fclose($fp);
?>

Any ideas as to what's being done wrong?


I'm pretty sure that you can't get at the input data through
php://input once PHP processes it.

Jun 4 '06 #4

yawnmoth wrote:
I tried using php://input in the following script but nothing is output
when I run it:


"$GLOBALS["HTTP_RAW_POST_DATA"] contains the raw POSTed data from a
request. Also available (obviously) as $HTTP_RAW_POST_DATA in the
global scope. Thanks to Manuel Lemos' SOAP server class for shedding
some light on the subject." -- m dot crawford at nospam dot home dot
com

"It should be noted that $HTTP_RAW_POST_DATA only exists if the
encoding type of the data is -not- the default of
application/x-www.form-urlencoded, and so, to accessing raw post data
from an HTTP form requires setting enctype= in your HTML." -- mike at
dbeat dot com

Jun 4 '06 #5
Sjoerd wrote:
yawnmoth wrote:
I tried using php://input in the following script but nothing is output
when I run it:


"$GLOBALS["HTTP_RAW_POST_DATA"] contains the raw POSTed data from a
request. Also available (obviously) as $HTTP_RAW_POST_DATA in the
global scope. Thanks to Manuel Lemos' SOAP server class for shedding
some light on the subject." -- m dot crawford at nospam dot home dot
com

"It should be noted that $HTTP_RAW_POST_DATA only exists if the
encoding type of the data is -not- the default of
application/x-www.form-urlencoded, and so, to accessing raw post data
from an HTTP form requires setting enctype= in your HTML." -- mike at
dbeat dot com


http://in.php.net/wrappers.php
php://input allows you to read raw POST data. It is a less memory
intensive alternative to $HTTP_RAW_POST_DATA and does not need any
special php.ini directives. php://input is not available with
enctype="multipart/form-data".

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jun 4 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Stelios G. Sfakianakis | last post: by
5 posts views Thread by Kingo | last post: by
3 posts views Thread by underground | last post: by
14 posts views Thread by jcage | last post: by
1 post views Thread by micksitup | last post: by
7 posts views Thread by gamernaveen | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.