0

I'm doing php cURL requests to an API (an ad exchange).

The request creates a report that takes 2-60 seconds to generate, depending on server load. (95% of the time, it only takes 2 seconds).

When I do this request, I get an array of data from the API, including the report status, which I set as $foundreportstatus. If I check $foundreportstatus immediately, it will say "In Progress".

Is there a way to recheck/update $foundreportstatus every 2 seconds, to see if the status has changed to 'Complete'?

It was suggested previously that I employ outside plugins (eg. Gearman) to handle an asynchronous request. Is there a way to avoid installing any plugins?

Chris
  • 191
  • 16
  • Hmm. I'm surprised that for a task as simple as this (regardless of the fact that it's asynchronous), I need to install something like Gearman. To other readers equally disheartened that this was "marked as duplicate", I want you to know that I can also get away with a dozen of the following in a row: if($foundreportstatus == "In Progress" || "Scheduled"){ sleep(1); } It's messy, but it works. – Chris Feb 22 '17 at 02:37
  • Async task is best; alternative is to change your UI to request this operation via an asynchronous call, then a blocking implementation is fine too. – Dima Tisnek Feb 23 '17 at 16:44

0 Answers0