
I wrote a simple bit of code to "throttle" my API calls (built into my API wrapper: I call it AFTER each API call. I know it's akward passing the URL of the last call. But using a getter for that would have been overly pedantic IMO.
// I set StartFrame in the objects' constructor.
$this->StartFrame = time() +1;
| public function throttle ($LastURL) {
| $this->getRateHeaders ($LastURL);
|
| if ($this->getRemaining() == 0) {
| $this->StartFrame += $this->getWindow() + 1;
| //time_sleep_until($this->StartFrame);
| }
| }
I have NOT yet tested this, because my allowed rate is 1, until they approve my app. Insha Allah today. It would have been nice if the API also returned how much time was left until the end of the frame...