M
M
Max Payne2015-01-05 17:16:06
PHP
Max Payne, 2015-01-05 17:16:06

Problem with POST and VK api. Why can't I contact VK api?

We have this code:

$text .= "
Поступила новая заявка на разблокировку! \r\n";
$text .= "Забаненный: vk.com/id".$_POST['id']." \r\n";
$text .= "Забанен: vk.com/id".$_POST['admin_id']." \r\n";
$is = 'https://api.vk.com/method/messages.send?access_token=токен&chat_id=1&message='.$text;
$is = json_decode(file_get_contents($is),true);
print_r($is);

After calling the VK api, the api returns an error:
[error_code] => 100
[error_msg] => One of the parameters specified was missing or invalid: message is empty or invalid

while further:
[4] => Array
                        (
                            [key] => message
                            [value] => 
                        )

But I kind of set the value to $text and....what's the problem? :) I tried to change single quotes to double ones and remove the line break \r\n.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Damir Makhmutov, 2015-01-05
@YardalGedal

And if so?

$is = 'https://api.vk.com/method/messages.send?access_token=токен&chat_id=1&message='.urlencode($text);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question