I make an API call which return a list of items. I use a foreach loop to iterate the JSON data:
foreach($decoded_results['items'] as $item) {
$image_link = $item['thumb'];
$link_url = $item['url'];
$subject = $item['title'];
}
I need some additional information for each item and in order to get that I need to call another endpoint.
In my first response every item in the JSON object has a property with an ID
that corresponds to a property with the same ID
in the other JSON object, that I get as a response when I call the second endpoint. This ID is needed as a parameter in the query string for the second API call.
What would be the best approach to accomplish this? I've looked into curl_multi
a little bit but not sure if this is suitable for the situation.