[Solved] php cURL undefined index


According to data flile you provide some of elements doesn’t include ‘platform’ property (see examples downhere).

So use techniques I sugessted before:

$platform = (isset($locations['platform']))?$locations['platform']:'';

You should verify if property exists before use it.

code:

foreach($result_arr['locations'] as $locations){

   $platform = (isset($locations['platform']))?$locations['platform']:'';
   echo '== PLATFORM : '.$platform.' <br />';
}

outputs:
== PLATFORM : 7
== PLATFORM : 9
== PLATFORM : 4
== PLATFORM : 2
== PLATFORM : 2
== PLATFORM : 3
== PLATFORM :
== PLATFORM : 1
== PLATFORM :
== PLATFORM : 2
== PLATFORM : 2
== PLATFORM :
== PLATFORM : 1
== PLATFORM : 1
== PLATFORM :
== PLATFORM :
== PLATFORM :
== PLATFORM : 2
== PLATFORM : 3

1

solved php cURL undefined index