V
V
Vitaly2018-02-26 14:30:37
PHP
Vitaly, 2018-02-26 14:30:37

How to get message text from Long Poll VK response?

Connected to the VKontakte Long Poll server...
I get a response via var_dump (for verification) in the form: stdClass Object ( [ts] => 1829295272 [updates] => Array ( [0] => Array ( [0] => 7 [ 1] => 205770650 [2] => 279132 ) [1] => Array ( [0] => 4 [1] => 279133 [2] => 49 [3] => 205770650 [4] => 1519644532 [ 5] => Long Poll Test ) ) )
Question : How to get the message text from this response using PHP?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
15x03243, 2019-01-01
@KenKup

$data = file_get_contents(url long floor);
$obj = json_decode($data); // decode json
echo $obj->updates->object->body; // output a message

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question