I have an array which is populating data from an API, I can print the value of the array but I can't print selected fields from the array. Here is the code snippet through which I can print the whole array...
if($apiResponse['response']['status'] === 1) {
// No errors encountered
echo 'API call successful';
echo PHP_EOL;
echo print_r($apiResponse['response']['data'], true);
echo PHP_EOL;
}
else {
// An error occurred
echo 'API call failed (' . $apiResponse['response']['errorMessage'] . ')';
echo PHP_EOL;
echo 'Errors: ' . print_r($apiResponse['response']['errors'], true);
echo PHP_EOL;
}
Here $apiResponse['response']['data'] is the array which contains the following value...I want to fetch the [name], [offer_url] and [preview_url] values from the array...here is the array which I am able to print...
( [3228] => Array ( [OfferUrl] => Array ( [id] => 3228 [offer_id] => 232
[name] => larl [offer_url] => http://www.nsssa.com/brands/loreacdl-paris.html/?utm_source=abcd&utm_medium=Affiliates [preview_url] => http://www.nsssa.com/brands/larl-paris.html/?utm_source=abcd&utm_medium=Affiliates
[status] => active [created] => 2014-10-23 03:15:29 [modified] => 0000-00-00 00:00:00 ) )
[3230] => Array ( [OfferUrl] => Array ( [id] => 3230 [offer_id] => 232
[name] => Schwarzkopf [offer_url] => http://www.nsssa.com/brands/schwarzkopf.html/?utm_source=abcd&utm_medium=Affiliates [preview_url] => http://www.nsssa.com/brands/schwarzkopf.html/?utm_source=abcd&utm_medium=Affiliates
[status] => active [created] => 2014-10-23 03:16:48
[modified] => 0000-00-00 00:00:00 ) )
Can anyone please help me with this.