PHP code example of rabotaru / oauth-client

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

    

rabotaru / oauth-client example snippets


$appId = 3803;
$secret = '7oRFT6vBEaohqud4PYT2ZmIUL1Kn3uBB';
$token = 'a4nQuLXM7x46sDwrUlrCbsg9w1f2xzxn';
$expires = 86000;


$client = new Client(
   $appId, $secret, $token, $expires
);

$url = $client->getAuthenticationUrl($redirect)

$code = $_GET['code'];
$client->requestToken($code);

    $route = '/v4/me.json';
    $params =  [];
    $method = "POST";
    
    $response = $client->fetch(
       $route, $params, $method 
    );
    
    echo $response->getJsonDecode();