PHP code example of duellsy / pockpack

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

    

duellsy / pockpack example snippets


$pockpath_auth = new PockpackAuth();
$request_token = $pockpath_auth->connect($consumer_key);

$pockpack = new PockpackAuth();
$data = $pockpack->receiveTokenAndUsername($consumer_key, $request_token);
$access_token = $data['access_token'];
$username = $data['username'];

$pockpack = new Pockpack($consumer_key, $access_token);
$as_array = true; // false will return JSON, true will return an array
$list = $pockpack->retrieve($options[, $as_array]); // the second parameter is optional, defaults to false

$options = array(
    'state'         => 'all',
    'favorite'      => 1,
    'detailType'    => 'complete'
);

$options = array(
    'state'         => 'favorite',
    'detailType'    => 'complete'
);

$link_info = array(
    'url'       => 'http://example.com'
);

$pockpack = new Pockpack($pocket_consumer_key, $pocket_access_token);
$pockpack_q = new PockpackQueue();

$pockpack_q->add($link_info);
$pockpack->send($pockpack_q);

$pockpack = new Pockpack($pocket_consumer_key, $pocket_access_token);
$pockpack_q = new PockpackQueue();

$tags = array("sampleTag1","sampleTag2");
$tag_info = array(
    'item_id'     => $item_id,
    'tags'        => $tags
    
);

$pockpack_q->tags_add($tag_info);

$pockpack->send($pockpack_q);