Home php Longpoll API VK PHP

Longpoll API VK PHP




read the documentation VK, and did not understand anything.

is also not clear: for which in the script to use While .
It seems like.
As I understand

  1. GetLongPollServer
  2. Get the answer
  3. process

If time has run out. We create a new request getlongpoll .
If an event: do what you need.
And send a request to the VC on the server that received in the getlongpollserver request. And + add TS

in the query

Why do While ?
If we make a request to VK.
And VK sends the answer.
It turns out: that VK comes to the site and sends JSON .
Just like in Callback .

Tell me please.
And better attach an example.

I know PHP normally.
But I know Longpoll badly.
Callback medium

Answer 1

In the case of Callback , VK itself sends requests to the processing site. Longpoll runs in the opposite direction: the application sends a request to VK to get the list of events that occurred
While is needed to send the following long query (as well as change the timestamp, starting with which you want to get the events, the most field TS ), and not complete the program

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions