1

I've got an HTTP POST pointed at two different places.

The first location is handled by a thirdparty solution, so I can't see how they're handling the data (which they must be because the values are getting through and I'm seeing results).

In my location, I have an NGINX server (which has never had any problems before with lots of use). I am using php to read the POST data, and I expect the content to be in the $_POST variable as the POST is $_SERVER["CONTENT_TYPE"] => "multipart/form-data"

But, even though the type and the $_SERVER["CONTENT_LENGTH"] are correct, I'm getting nothing in my $_POST, $_REQUEST, and when checking file_get_contents('php://input') there is nothing inside either.

The body is a very small json lump (<1k). Always an array of objects.

To see what's in the arrays I used echo json_encode( array( "GET" => $_GET, "POST" => $_POST, "REQUEST" => $_REQUEST, "SERVER" => $_SERVER ) )

I've run out of ideas of what to check now.

the entry $_SERVER["PHP_SELF"] has a strange garbling possibly due to the path delimiters?

Richard Fabian
  • 697
  • 1
  • 5
  • 18
  • `php://input` is not available with `enctype="multipart/form-data"`. courtesy: [SOFPOST-2731297](http://stackoverflow.com/questions/2731297/file-get-contentsphp-input-or-http-raw-post-data-which-one-is-better-to/2731431#2731431). Btw, How did you check the value inside `$_POST` or `$_REQUEST` array – Elavarasan Muthuvalavan - Lee May 09 '13 at 12:25

1 Answers1

1

How to post JSON to PHP with curl lead me to the solution:

Don’t forget to send it as application/json

Once I did that, the data came through in the body. This helps me, but I'm still curious as to why the third party receiver can handle the data as it was.

Community
  • 1
  • 1
Richard Fabian
  • 697
  • 1
  • 5
  • 18