PHP code example of farit-slv / vk-execute-builder

1. Go to this page and download the library: Download farit-slv/vk-execute-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

farit-slv / vk-execute-builder example snippets




use SMITExecute\Library\ExecuteRequest;

$builder = new ExecuteRequest(); // Конструктор ваших execut'ов

// Добавляем в запросы execut'a messages.getConversations
$builder->add(
        $builder->create()
        ->setMainMethod("messages")
        ->setSubMethod("getConversations")
        ->setParams([
            "user_id" => 89481221
        ])
);

// Добавляем ещё один запрос users.get
$builder->add(
    $builder->create()
        ->setMainMethod("users")
        ->setSubMethod("get")
        ->setParams([
            "user_id" => 89481221,
        ])
);

$code_strings = $builder->convertToJS(); // Конвертируем код в javascript (Возвращает массив строк javascript'a)
$code = implode(PHP_EOL, $code_strings); // Преобразовываем массив в строки.

$vk = new VKApiClient('5.00');
$response = $vk->getRequest()->post('execute', "token", [
    'code' => $code,
]);