PHP code example of mdeskorg / ok-php-sdk

1. Go to this page and download the library: Download mdeskorg/ok-php-sdk 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/ */

    

mdeskorg / ok-php-sdk example snippets


        $appKey = '***';
        $sessionKey = '***';
        $sessionSecretKey = '***';
        $client = new OkClient($appKey, $sessionKey, $sessionSecretKey);
        $userId = '***'
        return $client->getUserInfo($userId);

//        array:1 [▼
//          0 => array:4 [▼
//              "uid" => "583933080208"
//              "first_name" => "Dymok"
//              "last_name" => "Dymokhodov"
//              "pic_full" => "https://i.mycdn.me/i?r=A0E2egivtM5K0QtANiL-Q08jCdFW-4UxdccMIMHC0dQOSA9xMkabEL003Q-moyPajkhPu_kFbvzHXO2hebzDxCqE"
//              ]
//          ]
        


        $chatId = '***';
        $message = 'Тестовое сообщение';
        $token = '***';
        $images = [
            'https://st.mycdn.me/res/i/ok_logo.png',
            'https://st.mycdn.me/res/i/ok_logo.png'
        ];
        $client = new OkChatsClient($token);
        return $client->sendMessage($chatId, $message, $images);

//      array:3 [▼ 
//          "success" => true
//          "recipient_id" => "chat:C64f8bc880000"
//          "message_id" => "mid:C64f8bc880000.18a753095991615"
//      ]