I'm trying to retrieve data from a third party provider. They send us the data in a request with Content-Type: application/x-www-form-urlencoded
. On our end, we parse the data in both the $_POST
and $_GET
variables like this:
print_r($_POST);
print_r($_GET);
The arrays are empty:
Array
(
)
Array
(
)
I also tried getting the data with file_get_contents('php://input')
, but it prints an empty string.
Checking the $_SERVER
variable, we notice that the content-type
is indeed application/x-www-form-urlencoded
and that the REQUEST_METHOD
is indeed POST
.
Does anyone have any pointers to where we can access the data sent?
(We made sure the problem is on our-hand by changing our URL with an URL from RequestBin and seeing the data there.)
EDIT
The response we get when we switch our URL with a http://requestb.in:
amount: 2200
pay_from_email: [REDACTED]
lma_transaction_id: [REDACTED]
md5sig: [REDACTED]
transaction_id: 761
merchant_fields: cart_id
lma_amount: 2200
status: 2
pay_to_email: [REDACTED]
cart_id: 11242
merchant_id: [REDACTED]
The headers of the request are:
X-Request-Id: [REDACTED]
User-Agent: [REDACTED]
Connection: close
Content-Type: application/x-www-form-urlencoded
Host: requestb.in
Content-Length: 326
EDIT
var_dump(getallheaders());
prints:
[User-Agent] => [REDACTED] (Name of the third-party provider)
[Content-Type] => application/x-www-form-urlencoded
[Host] => [REDACTED]
EDIT
apache_request_headers()
prints:
[Host] => [REDACTED]
[DNT] => 1
[Cookie] => [REDACTED]
[Connection] => keep-alive
[Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[User-Agent] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.74.9 (KHTML, like Gecko) Version/7.0.2 Safari/537.74.9
[Accept-Language] => fr-fr
[Accept-Encoding] => gzip, deflate
[Cache-Control] => max-age=0