How to dump FORM POST data to screen?
Moderator: General Moderators
How to dump FORM POST data to screen?
I would like to see the raw code sent by an HTML page using the FORM POST function. I would like to mimic this data for a app I am working on.
Is there a way I can output the raw data to the screen as part of a php script?
Thanks
Greg
Is there a way I can output the raw data to the screen as part of a php script?
Thanks
Greg
var_dump()
$_POST
or for those that like less ugly stuff
$_POST
or for those that like less ugly stuff
Code: Select all
ob_start();
var_dump($_POST);
$dump = ob_get_contents();
ob_end_clean();
echo str_replace(Array(" ","\n"),Array(" ","<br>"),$dump);Code: Select all
print_r($_POST);take a look at http://de2.php.net/manual/en/ini.core.p ... -post-datagmrobert wrote:Is there a way I can output the raw data
man I had no idea about the return parameter. That's pretty cool. But I sitll like var_dump cause it sounds cooler than print_r.The Ninja Space Goat wrote:Code: Select all
print_r($_POST);
Thank you for the posts, all the methods work well.
Is there a way I can see all the http code that is sent with the headers?
The info defined in http://www.w3.org/Protocols/rfc2616...-sec4.html#sec4 is what I am after.
volka,
I think you are pointing me in the right direction but I am not sure how to implement the function you identified.
Thanks
Greg
Is there a way I can see all the http code that is sent with the headers?
The info defined in http://www.w3.org/Protocols/rfc2616...-sec4.html#sec4 is what I am after.
volka,
I think you are pointing me in the right direction but I am not sure how to implement the function you identified.
Thanks
Greg
requires php 4.3+
for http headers see http://de2.php.net/manual/en/function.getallheaders.php
Code: Select all
<html>
<head><title>raw post data</title></head>
<body>
<pre><?php echo htmlentities(file_get_contents('php://input')); ?></pre>
<form method="post" action="test.php">
<div>
<input type="text" name="abc[]" />
<br />
<input type="text" name="abc[]" />
<br />
<input type="text" name="xyz" />
<br />
<input type="submit" />
</div>
</form>
</body>
</html>- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
arborint,
That function is really cool, I will definitely use it.
volka,
Your function is what I needed to know. All I need to do now is decode the format of the characters in the POST function so I can build my own mimic of a POST function to send data from my app in the same manner as a Browser.
Thank you both for all your help it has really got me headed in the right direction now.
Greg
That function is really cool, I will definitely use it.
volka,
Your function is what I needed to know. All I need to do now is decode the format of the characters in the POST function so I can build my own mimic of a POST function to send data from my app in the same manner as a Browser.
Thank you both for all your help it has really got me headed in the right direction now.
Greg
There scripts/classes that can assist you. E.g. http://pear.php.net/manual/en/package.h ... client.phpgmrobert wrote:All I need to do now is decode the format of the characters in the POST function so I can build my own mimic of a POST function to send data from my app in the same manner as a Browser.
What do you need to decrypt?
volka,
I would like to send data from a Palm OS app to a web server. The Palm OS allows me to use sockets but then I have to write the http headers. Another solution is to use a C++ library and use a library http/https POST function. (http://www.pdadevelopers.com/homehttps.htm).
The http/https library is fairly well documented but it does not provide much info on:
1. How to handle the data received on the Server Side (I would prefer php)
2. What are standard formats used for sending data (I would like to use the FORM POST method).
I was hoping that if I sent my data in the same manner as a http POST function I could do the Server Side stuff with php as if I was receiving a FORM POST from a Browser.
Do you have any other suggestions on how to handle this?
Do you know where I could find more technical info on the schema used for the POST data sent by the Browser to the Server?
Thank you for all your help so far it has been tremendous.
Greg
I would like to send data from a Palm OS app to a web server. The Palm OS allows me to use sockets but then I have to write the http headers. Another solution is to use a C++ library and use a library http/https POST function. (http://www.pdadevelopers.com/homehttps.htm).
The http/https library is fairly well documented but it does not provide much info on:
1. How to handle the data received on the Server Side (I would prefer php)
2. What are standard formats used for sending data (I would like to use the FORM POST method).
I was hoping that if I sent my data in the same manner as a http POST function I could do the Server Side stuff with php as if I was receiving a FORM POST from a Browser.
Do you have any other suggestions on how to handle this?
Do you know where I could find more technical info on the schema used for the POST data sent by the Browser to the Server?
Thank you for all your help so far it has been tremendous.
Greg
start with http://www.w3.org/, left side: httpgmrobert wrote:Do you know where I could find more technical info on the schema used for the POST data sent by the Browser to the Server?
RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1 (Postscript), (PDF) (compressed text)
That is a great link ... I think I found what I was looking for here:
http://www.zend.com/zend/spotlight/mimocsumissions.php
Thank you
Greg
http://www.zend.com/zend/spotlight/mimocsumissions.php
Thank you
Greg