L
L
LNK2017-05-01 21:44:33
PHP
LNK, 2017-05-01 21:44:33

Why is the message truncated when sent via vk api/curl (PHP)?

Greetings. Here is my code for sending a message via vk API + curl:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.vk.com/method/messages.send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['peer_id'=>$peer_id, 'message'=>$message, 'v'=>$v, 'access_token'=>$access_token]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

When sending large messages (4.5-5 thousand characters), I receive only a truncated message, while vk does not return any errors. I get 4090 characters (although it used to come in less, not always 4090). I tried to send my message through the VK site - everything works fine and is not cut off. The documentation does not say anything about limiting the amount of text. What is my problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question