Receive JSON POST with PHP

前端 未结 7 2300
Happy的楠姐
Happy的楠姐 2020-11-21 04:42

I’m trying to receive a JSON POST on a payment interface website, but I can’t decode it.

When I print :

echo $_POST;

I get:

7条回答
  •  隐瞒了意图╮
    2020-11-21 05:28

    Try;

    $data = json_decode(file_get_contents('php://input'), true);
    print_r($data);
    echo $data["operacion"];
    

    From your json and your code, it looks like you have spelled the word operation correctly on your end, but it isn't in the json.

    EDIT

    Maybe also worth trying to echo the json string from php://input.

    echo file_get_contents('php://input');
    

提交回复
热议问题