Ben
Ben

Reputation: 11188

Equivallent for $_SERVER['argv'] when using $_POST?

I'm wondering if there is a $_POST equivallent for $_SERVER['argv'], which only works with $_GET.

This is because my ajaxscript recently changed from $_GET to $_POST due to IE7 issues but the query passed into the ajaxfunction is quite long.

So if there is a simple alternative rather than to reconstruct the $_GET string from a $_POST array that would be nice :)

Upvotes: 2

Views: 231

Answers (2)

Peter Bailey
Peter Bailey

Reputation: 105878

Yes, you can read the raw POST body like so

$postBody = file_get_contents( 'php://input' );

Upvotes: 6

Arda Xi
Arda Xi

Reputation: 2666

There's no way I can find to get the actual POST string, but it's pretty easy to construct it.

$poststring = http_build_query($_POST);

Upvotes: 1

Related Questions