473,396 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 38569
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stelios G. Sfakianakis | last post by:
Hello, I am using php 4.2.2 in Red Hat 9.0 with apache 2.0.40 I try to build a php script that accepts POST requests that contain multimedia data and shoves them in a MySQL database. My problem is...
17
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php"...
5
by: Kingo | last post by:
I have a HTML form where the user can type in certain values, but I only want them to able able to submit integers (0-9). I post to a PHP page with the following "snippit" of code (all the...
3
by: underground | last post by:
I found this form on the scripts. However when I attemp to open the php file on the sever I get a error message Parse error: syntax error, unexpected $end on line 238 <? /** * Main.php * *...
5
by: oaktown | last post by:
Running two input forms on the same page, one php and the other (the one I would like to create) to be written in perl. The idea is to accept an input from a perl script, then pass that input to two...
14
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be...
1
by: micksitup | last post by:
hi all. I have 3 files:- Pick_moduser.php do_moduser.php show_moduser.php problem is it just doesnt want to pass anything through
7
by: gamernaveen | last post by:
I've been busy coding a signup system with PHP. There are 2 forms , form1 and form2. form1 contains: Name , Age , form 2 contains Username , Password , Repeat Pass , Email I use POST method...
4
maxamis4
by: maxamis4 | last post by:
I currently have an input form in HTML. I am trying to use JavaScript to validate that the html forms are entered. I had it working earlier today but now my form is not validating. Could someone take...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.