Answer the question
In order to leave comments, you need to log in
Can you help find the magic in php sdk VKontakte?
Hello.
There is a VK API, it has a limit - no more than 3 requests per second. Whoever violates - will receive an error code 6 , and a notification
Too many requests per second
$vk = new \VK\Client\VKApiClient(VK_API_VERSION);
for ($i = 0; $i < 30; $i++) {
$vk->messages()->send(....);
}
Answer the question
In order to leave comments, you need to log in
As sleeps, the request itself plays a role in you. PHP code is executed sequentially. It depends on the speed of the iteration, sometimes you are lucky and the iteration slows down for a quarter of a second. And sometimes the opposite will be done quickly and too many requests catch the error
These restrictions are laid down by the infrastructure / web servers of VKontakte, this should not be in the SDK - this is just a layer of code to facilitate work
So you consistently send them and are surprised?
Well, as an example from life, there is a thin tunnel one person crawls into it, you send 30 people sequentially one at a time and they crawl through and are surprised how 30 of them fit into a tunnel one wide
Well, be a fool, run 30 requests in threads and immediately see the expected result
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question