PHP code example of atehnix / vk-client

1. Go to this page and download the library: Download atehnix/vk-client 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/ */

    

atehnix / vk-client example snippets


    $api = new Client;

    $response = $api->request('wall.get', ['owner_id' => 1]);

    $api = new Client;

    $request = new Request('wall.get', ['owner_id' => 1]);
    $response = $api->send($request);

    $api = new Client;

    $execute = ExecuteRequest::make([
        new Request('wall.get', ['owner_id' => 1]),
        new Request('wall.get', ['owner_id' => 2]),
        // ... few requests
        new Request('wall.get', ['owner_id' => 25]),
    ]);

    $response = $api->send($execute);

  $api = new Client('5.60');

    $api = new Client;

    $api->setDefaultToken("some_token");

    // ...

    $api = new Client;

    // Token in the request is a higher priority than the default token.
    $request = new Request('wall.get', ['owner_id' => 1], "some_token");

    // ...

    $auth = new Auth('client_id', 'client_secret', 'redirect_uri');

    echo "<a href='{$auth->getUrl()}'>ClickMe<a>";

    // ...

    $token = $auth->getToken($_GET['code']);