I am currently working with a 3rd party API which I cannot disclose. The summary is:
action -> 3rd party -> callback
So my server communicates with 3rd party with some data
Once the data is sent back, the 3rd party sends an XML to the callback url.
I am receiving the callback with the headers:
Content-type: application/xml Content-length: 69 Request-method: POST
However, print_r($_POST) is showing nothing at all. Nor is $_GET.
What could be going on? I know you cannot give me the most detailed answer based on my vagueness but if you could point me in the right direction, that would be brilliant.
Yes, you can send a request body with GET but it should not have any meaning.
You can fetch this data with this snippet: $request_body = file_get_contents('php://input'); If you are passing json, then you can do: $data = json_decode($request_body);
PHP $_REQUEST is a PHP super global variable which is used to collect data after submitting an HTML form. The example below shows a form with an input field and a submit button. When a user submits the data by clicking on "Submit", the form data is sent to the file specified in the action attribute of the <form> tag.
You can use explode() on "&" then you will get data in array format. so if your payload string is not at fixed position then you can use foreach loo p in which you can find the payload string is present in string or not with help of strchr() .
Use php://input :
$post = file_get_contents('php://input');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With