Error when setting server Callback API VK?

Set up a server for the community POST-request

$url = '';
 $params = array(
 'group_id' => $d['id_group'],
 'url' => '', // If you hid the name of your website
 'title' => 'Server', 
 'access_token' => $d['token'], // access_token 
 'v' => '5.73',

 // In the $result will return the id of the sent message
 $requestpost = file_get_contents($url, false, stream_context_create(array(
 'http' => array(
 'method' => 'POST',
 'header' => 'Content-type: application/x-www-form-urlencoded',
 'content' => http_build_query($params)

Comes out this error

Tried and GET the queries and changed the file encoding didn't work, not set via API. And when you press confirm manually everything works, the light turns green checkmark. How to fix it?
June 7th 19 at 14:43
4 answers
June 7th 19 at 14:45
For those who will then Google:
if the callback server is added via the API, and a verification code you need to get through the API method groups.getCallbackConfirmationCode. It differs from the code in the web-version of the site.
Is it possible directly in the code to make manual insertion of the server, and that worked through the API too? - ludie commented on June 7th 19 at 14:48
June 7th 19 at 14:47
The server address wrong write. Just
But in api.php already write:
$confirmation_token = '58e46a05';
$data = json_decode(file_get_contents('php://input'));
switch ($data->type):
 case 'confirmation': echo $confirmation_token; break;
 case 'wall_post_new': the response to the event; echo('ok'); break;
Key use because of several communities from the database - ludie commented on June 7th 19 at 14:50
Realized the error, I used the code from the group itself and not from the groups.getCallbackConfirmationCode - ludie commented on June 7th 19 at 14:53
June 7th 19 at 14:49
Use file_get_contents to query, and a slap on the wrist :)
Was done in haste, it works.. Your options? ))) - ludie commented on June 7th 19 at 14:52
cURL - ludie commented on June 7th 19 at 14:55
Guzzle, unirest - ludie commented on June 7th 19 at 14:58
these libraries are built on cURL. - kiley.Auer commented on June 7th 19 at 15:01
and how to check strings for API and manual settings, and they have different codes in the method is written.

Method: groups.getCallbackConfirmationCode - maud_MacGyv commented on June 7th 19 at 15:04
June 7th 19 at 14:51
Doing the test this way:

$groupsgetCallbackConfirmationCode = json_decode(file_get_contents("{$cal['id_group']}&access_token={$cal['token']}&v=5.73")); 

// String to confirm the server address from the settings API Callback 
//$confirmation_token = $cal['confirmation_token']; 
$confirmation_token = $groupsgetCallbackConfirmationCode->response->code;
// The API version
$v = '5.73';

// The key community to send messages (on behalf of sent messages)
$token_message = 'token';

//Get and decode the notification 
$data = json_decode(file_get_contents('php://input')); 

//Check what is in the "type" 
switch ($data->type) { 
//If this notification is to confirm the address... 
case 'confirmation': 
//...send the line to confirm 
echo $confirmation_token; 

how to check when inserting the server manually, not via API?

that is, it should check $confirmation_token = $cal['confirmation_token'];
not quite understand what to do want in the end.
If you have a situation when the server address is passed to the "group" for which you have confirmed, via groups.getCallbackConfirmationCode request that "must answer" for each group and check. - ludie commented on June 7th 19 at 14:54

Find more questions by tags VKontakte