I have got a result back from the AWS API and im trying to pick out data from the returned JSON, i want to be able to read results and use for inserting into a SQL DB
here is my code
$result = $ec2Client->describeInstances();
$result2 = json_encode($result->toArray(), JSON_PRETTY_PRINT);
$info = (json_decode($result2, true));
foreach($info['Reservations'] as $currFeature)
{
$currEvent = $currFeature['Instances']['ImageId'];
echo $currEvent;
}
but i get the following returned
Undefined index: ImageId in C:\aws\index.php on line 34
Can someone advise on the how i can reference instance id in the results, here is an extract from the output i want to pull some the data out so can refenrece it, many thanks for your support
array(2) {
["Reservations"]=>
array(17) {
[0]=>
array(4) {
["Groups"]=>
array(0) {
}
["Instances"]=>
array(1) {
[0]=>
array(36) {
["AmiLaunchIndex"]=>
int(0)
["ImageId"]=>
string(AWS result) "ami-00967c66c84d2044e"
["InstanceId"]=>
string(19) "i-0404f283a4dd61304"
Thanks