I am trying to pull a specific object from the API call output in json.
{"result":[{"created_at":1567946574,"id":123456,"ip":"10.0.0.1/32","updated_at":1567946574},{"created_at":1588953004,"id":123457,"ip":"10.0.0.2/32","updated_at":1588953004},{"created_at":1588953021,"id":123458,"ip":"10.0.0.3/32","updated_at":1588953021},{"created_at":1588953090,"id":123459,"ip":"10.0.0.4/32","updated_at":1588953090},{"created_at":1588953090,"id":123460,"ip":"10.0.0.5/32","updated_at":1588953090}]}
I want to pull the value of id based on IP value.
Say i have IP 10.0.0.4, i want its id using php.
I have set up a code to just pull ID as of now, but it doesn't work. Can anyone help me?
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$characters = json_decode($response); // decode the JSON feed
foreach ( $characters as $output ) {
echo $output->id;
}