I am using Tropo Web API, to get result from a chat application, i redirected my JSON response to my server side PHP file(http://myhost.in/vj/app3.php?tropo-engine=json), the JSON response is coming correctly but i am not able to fetch data from that using PHP, the JSON response is as follows..
{
"result": {
"actions":
[
{
"attempts": 2,
"concept": "mumbai",
"confidence": 100,
"disposition": "SUCCESS",
"interpretation": "mumbai",
"name": "city",
"utterance": "mumbai",
"value": "mumbai",
"xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result grammar=\"[email protected]\"><interpretation grammar=\"[email protected]\" confidence=\"100\"><instance>mumbai<\/instance><input mode=\"voice\" confidence=\"100\" timestamp-start=\"1970-01-01T00:00:00.000\" timestamp-end=\"1970-01-01T00:00:00.000\">mumbai<extensions><word-confidence> 100 <\/word-confidence><\/extensions><\/input><extensions><probability> 0 <\/probability><nl-probability> 0 <\/nl-probability><necessary-word-confidence> 0 <\/necessary-word-confidence><\/extensions><\/interpretation><\/result>\r\n\r\n"
},
{
"attempts": 1,
"concept": "cricket",
"confidence": 100,
"disposition": "SUCCESS",
"interpretation": "cricket",
"name": "sports",
"utterance": "cricket",
"value": "cricket",
"xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result grammar=\"[email protected]\"><interpretation grammar=\"[email protected]\" confidence=\"100\"><instance>cricket<\/instance><input mode=\"voice\" confidence=\"100\" timestamp-start=\"1970-01-01T00:00:00.000\" timestamp-end=\"1970-01-01T00:00:00.000\">cricket<extensions><word-confidence> 100 <\/word-confidence><\/extensions><\/input><extensions><probability> 0 <\/probability><nl-probability> 0 <\/nl-probability><necessary-word-confidence> 0 <\/necessary-word-confidence><\/extensions><\/interpretation><\/result>\r\n\r\n"
}
],
"callId": "b546e03db1ccfd2f0e8c58d970539501",
"complete": true,
"error": null,
"sequence": 1,
"sessionDuration": 11,
"sessionId": "ed6abc73b9c434385ea8cd8004c9ed0c",
"state": "ANSWERED"
}
}
the PHP code that i am using...
$json = file_get_contents("php://input");
$result = json_decode($json);
$value =$result->result->actions->value;
but i am getting null in the variable $value. How will get the value for city and sports as well..??