\paperturn

Paperturn API Class

Show your Paperturn publications directly on yout webpage.

Download API class & sample


Example:
define(PAPERTURN_ACCESS_KEY_ID,'replace with your paperturn access key');
define(PAPERTURN_SECRET_ACCESS_KEY,'replace with your paperturn secret key');

//require API class
require_once('paperturn.class.php');

//create paperturn API object
$paperturn = new paperturn( PAPERTURN_ACCESS_KEY_ID, PAPERTURN_SECRET_ACCESS_KEY );

//get list of publications order by publish date
$ppPubs = $paperturn->getPublications( '', 'PublishDate' );

//loop through the objects and show the cover of the publication with a link on it
foreach ( $ppPubs as $key => $value ) {
echo '<a href="'.$value->Url.'" target="_blank" title="'.$value->Title.'" style="text-align: center; width: 200px; display: block; float: left; margin-right: 5px; margin-bottom: 20px;"><img src="'.$value->Cover.'" width="100%" alt="'.$value->Title.'"><br>'.$value->Title.'</a>';
}

Summary

Methods
Properties
Constants
__construct()
setAuth()
getPublications()
getUnsecuredUrl()
setExpDelay()
hash()
$expdelay
No constants found
No protected methods found
No protected properties found
N/A
timestamp()
sha3()
$ppurl
$accesskey
$secretkey
N/A

Properties

$expdelay

$expdelay

string $expdelay Lifetime of the request/links

$ppurl

$ppurl

string URL to paperturn API

$accesskey

$accesskey

string $accesskey Accesskey to your Paperturn account

$secretkey

$secretkey

string $secretkey Secretkey to your Paperturn account

Methods

__construct()

__construct(string $accesskey, string $secretkey) : void

Constructor, used if you're not calling the class statically

Parameters

string $accesskey

Access key

string $secretkey

Secret key

setAuth()

setAuth(string $accessKey, string $secretKey) : void

Set access information

Parameters

string $accessKey

Access key

string $secretKey

Secret key

getPublications()

getPublications(string $search_for, string $sortby, integer $limit_start, integer $limit_end, boolean $get_pages) : array

Get a list of publications

Parameters

string $search_for

String to search for in title and description

string $sortby

Sort the list by Id, Title, Private, PublishDate, Language

integer $limit_start

Start listing from index

integer $limit_end

Length of list items from start index

boolean $get_pages

Include pages data in the result

Returns

array —

| false

getUnsecuredUrl()

getUnsecuredUrl(integer $pub_id, integer $page_nr, integer $expdelay) : void

Get unsecured Url (no login / no IP check) to a private publication

Parameters

integer $pub_id

Publication's ID

integer $page_nr

(optional) Direct Url to a page

integer $expdelay

(optional) Lifetime of the generated Url

setExpDelay()

setExpDelay(integer $expdelay) : void

Set request expire delay in seconds

Parameters

integer $expdelay

Keep the query alive to $expdelay seconds

hash()

hash() : string

Generate hash code from arguments

Returns

string

timestamp()

timestamp() : integer

Get server's timestamp in GMT +0000 timezon

Returns

integer

sha3()

sha3(string $str) : string

Encode string with sha512

Parameters

string $str

Returns

string