I am trying to add data from 2 APIs to my database (using CraftCMS). I am querying 2 endpoints - one of which queries all posts (/postings) then another queries each post (/postings/). I am currently looping through each item in the postings API then querying the API:
foreach ($data AS $item) {
$this->queryPostingItem($item->id);
}
I am using Guzzle to fetch the data in each method. But getting a curl timeout error. What options do I have to fetch all the posting data? I believe that there is a limit of 2 api calls per second. I have tried adding sleep(1);
to the loop after every few loops but it isn't helping.
Bit stuck.