fork download
  1. <?php
  2.  
  3. //$str = file_get_contents('php://input');
  4. $str = '{
  5. "sessionId": "2_MX4xMzExMjU3MX5-MTQ3MDI1NzY3OTkxOH45QXRr",
  6. "projectId": "123456",
  7. "event": "connectionCreated",
  8. "timestamp": 1470257688309,
  9. "connection": {
  10. "id": "c053fcc8-c681-41d5-8ec2-7a9e1434a21e",
  11. "createdAt": 1470257688143,
  12. "data": "TOKENDATA"
  13. }
  14. }';
  15.  
  16. if ($str) {
  17. // decode JSON
  18. $json = json_decode($str, true);
  19. // get the data
  20. $Session_ID = $json['sessionId'];
  21. $start_time = $json['connection']['createdAt'];
  22. echo("$Session_ID\n");
  23. echo("$start_time\n");
  24. }
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
2_MX4xMzExMjU3MX5-MTQ3MDI1NzY3OTkxOH45QXRr
1470257688143