Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the raw POST data?

Tags:

php

I'm trying to understand the meaning of raw POST data. The PHP manual page for $HTTP_RAW_POST_DATA just state that this variable contains Raw POST data.

When will this variable be set and what's the meaning of raw POST data?

I understand the $_POST, but I am totally confused with $HTTP_RAW_POST_DATA.

like image 747
Daric Avatar asked Aug 30 '12 10:08

Daric


2 Answers

HTTP is a text-based protocol, so all the data is passed as a strings. When you work with $_POST - you already have the passed data processed for you to be in an array form. This is done by PHP automatically right before the control is passed to your script.

So in the raw POST data there is data as it was passed through the network.

Likely you see a=1&b=2 data, as you see it in URLs.

like image 152
zerkms Avatar answered Sep 17 '22 12:09

zerkms


$HTTP_RAW_POST_DATA contains the raw POST data like in the following formats:

  • text
  • JSON
  • XML
  • HTML

In general, php://input should be used instead of $HTTP_RAW_POST_DATA. because this feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged.

Source: php.net - $HTTP_RAW_POST_DATA

like image 25
Adrian Enriquez Avatar answered Sep 20 '22 12:09

Adrian Enriquez