S
S
Space2015-06-03 04:30:23
Yii
Space, 2015-06-03 04:30:23

How to limit the number of requests per minute?

I extract data from VK. But VK complains that I am doing too many requests per second. How it is possible to bypass it?
In the code below, I first get the number of posts, how many times I need to offset and I already get the posts.

$piecesPosts = Yii::$app->vk->api('wall.get', array('owner_id' => '-10639516'));

        $countPiecesPosts = $piecesPosts['response'][0];
        $cp = $countPiecesPosts / 100;
        $cp = ceil($cp);
        for ($c = 0; $c < $cp; $c++) {
            $coue = 99 * $c;

            $getPosts = Yii::$app->vk->api('wall.get', array('owner_id' => '-10639516', 'count' => '99', 'offset' => $coue));
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-06-03
@ruslite

php.net/manual/en/function.sleep.php
php.net/manual/en/function.time-nanosleep.php
php.net/manual/en/function.usleep.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question