I have an api and i want to parse data from it using php
That's the response
{
"success": true,
"data": [
{
"medicineId": 12,
"medicineName": "Abacavir"
},
{
"medicineId": 10,
"medicineName": "Alclometasone"
},
{
"medicineId": 15,
"medicineName": " Alectinib"
},
{
],
"message": "Successfully retrieved"
}
I want to list all medicine names
i tried this but it doesn't get the name just the success response
$age = file_get_contents('link');
$array = json_decode($age, true);
foreach($array as $key=>$value)
{
echo $key . "=>" . $value . "<br>";
}
echo '<pre>'; var_dump($array); echo '</pre>';orprint_r($array);both will work or you can install chrome extensions like json formatter so that you can save you time in doing that.