Get return in PHP JSON

1

There is a system that has sent me a return every day, but I am not able to receive the data to record in the bank, can someone give me a light?

This is the data sent by the system

 -H 'Content-Type: application/json' \
  -d '{
    "uuid": "6ae29dfb29ad4dd29ce6bf454800c7db",
    "payment_type": "boleto",   
    "amount": 100,
    "status": "pending",   
    "external_id": "order 1",
    "expiration_date": "2018-07-13T21:00:00-03:00",
    "created_at": "2018-07-11T16:51:18-03:00"
}'

I need to get uuid, expiration_date and status to write to the bank!

    
asked by anonymous 11.07.2018 / 22:21

1 answer

2

Try using the json_decode ();

<?php
$json = json_decode(file_get_contents('php://input'), true);
$uuid = $json['uuid'];
$payment_type = $json['payment_type'];
$amount = $json['amount'];
$status = $json['status'];
$external_id = $json['external_id'];
$expiration_date = $json['expiration_date'];
$created_at = $json['created_at'];
...
?>

Now, just implement the database.

    
12.07.2018 / 10:12