PHP code example of mcmatters / pocket-api

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

    

mcmatters / pocket-api example snippets




declare(strict_types=1);

use McMatters\PocketApi\PocketAuthenticationClient;

om';

$authClient = new PocketAuthenticationClient($consumerKey);

$token = $authClient->request($redirectUri);

$url = $authClient->getAuthorizeUrl($token['code'], $redirectUri);

// Redirect user to the url

// After that obtain access_token
$response = $authClient->authorize($token['code']);

$accessToken = $response['access_token'];




declare(strict_types=1);

use McMatters\PocketApi\PocketClient;

XX-XXXX-XXXX-XXXXXX';

$client = new PocketClient($consumerKey, $token);

$client->add('https://example.com');

$articles = $client->retrieve();