Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created March 23, 2016 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodwardtw/fff04ea68b269830bb65 to your computer and use it in GitHub Desktop.
Save woodwardtw/fff04ea68b269830bb65 to your computer and use it in GitHub Desktop.
gets me a list of all bookmarks tagged 'weekly' for the last week via the pinboard API. uses https://github.com/kijin/pinboard-api
<?php
include 'pinboard-api.php'; //https://github.com/kijin/pinboard-api
$pinboard = new PinboardAPI('USERNAME','PASSWORD');
date_default_timezone_set('UTC');
$date = date_create('now');
$lastweek = date_sub($date, date_interval_create_from_date_string('7 days'));
$lastweek = date_format($date, 'Y-m-d');
$weekly = $pinboard->get_all(null,null,'weekly', $lastweek,null);
//var_dump($weekly);
echo '<ul>';
foreach ($weekly as $bookmark) {
echo '<li><a href="' . $bookmark->url . '">' . $bookmark->title . '</a><br>' ;
echo '<blockquote>' . $bookmark->description . '</blockquote></li>';
// echo implode(' ',$bookmark->tags) . " => " . "</li>";
sleep(3); // honor API rate limit
}
echo '</ul>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment