PHP: Get body of request received

10,892

Use php://input :

$post = file_get_contents('php://input');
Share:
10,892
Ozzy
Author by

Ozzy

Updated on June 06, 2022

Comments

  • Ozzy
    Ozzy almost 2 years

    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.