- var_dump: documentation ( source)
- json_decode: documentation ( source)
<?php
$json = '{
"status": "success",
"code": 200,
"data": {
"total": 5003,
"max_score": null,
"hits": [
{
"_index": "latestlogs",
"_type": "logs",
"user_id": "rgertg4356ert",
"_score": 13.127081,
"_source": {
"allcaller_id": "453454534",
"source": "1",
"company_id": "353454355",
"caller_number_raw": "4353445345",
"_cm": "",
"caller_number": "+34534545",
"country": "91",
"state": "IN",
"synced_time": 1554898407,
"start_time": 1554898251,
"_ms": 1554898251000,
"seconds": 43851,
"end_time": 1554898366,
"duration": "00:01:55",
"_drm": 1.92,
"type": 1,
"event": 1,
"filename": "fgdfg.mp3",
"fileurl": "google.com/mp3",
"_ns": "0",
"status": 1,
"department_name": "During Office",
"department_id": "r43rfdt43refd",
"additional_parameters": [
{
"ky": "unique_id",
"vl": "d2.1554898249.1594961"
},
{
"ky": "is_starred",
"vl": "0"
},
{
"ky": "view_type",
"vl": "2"
},
{
"ky": "is_commented",
"vl": "0"
},
{
"ky": "is_archived",
"vl": "0"
},
{
"ky": "internal_flag",
"vl": "1"
}
],
"comments": [
],
"log_details": [
{
"received_by": [
{
"user_id": "43535rfret",
"name": "Peter",
"email": "",
"extension": "13",
"contact_number_raw": "53534543",
"contact_number": "+343243535"
}
],
"transfered_to": [
],
"status": "1",
"start_time": 1554898284,
"end_time": 1554898366,
"duration": "00:01:22",
"action": "received"
}
],
"_us": [
{
"ky": "dfsdf",
"vl": "received"
}
],
"_tc": [
{
"ye": "dsfsdf",
"yf": 82
}
],
"_ri": ""
}
}
]
}
}';
$x = json_decode($json, true);
foreach ($x['data']['hits'] as $key => $val) {
$receivedBy = $val['_source']['log_details'][0]['received_by'][0];
var_dump($receivedBy);
}