Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- ob_start();
- date_default_timezone_set("GMT");
- $api_key = '*************';
- $username = '****************';
- $password = '*************';
- require('plurk_api.php');
- $plurk = new plurk_api();
- $plurk->login($api_key, $username, $password);
- function makeoffset($timestamp){
- //2009-6-20T21:55:34.
- return date('Y-n-j\TH:i:s', $timestamp);
- }
- $timestamp = time();
- $usercount = array();
- $i=0;
- do{
- $timestamp = $timestamp-1;
- echo "Set offset = " . makeoffset($timestamp) . "\n";
- $data = $plurk->get_plurks(makeoffset($timestamp), 50);
- $count = count($data->plurks);
- foreach($data->plurks as $plurkdata){
- $posted = $plurkdata->posted;
- $usercount[$plurkdata->owner_id]++;
- echo $plurkdata->plurk_id . " " . $plurkdata->posted . "\n";
- }
- $timestamp = strtotime($posted);
- if(!$timestamp){
- print_r($data);
- exit;
- }
- $i++;
- echo "\nNew iter $i - $posted, $timestamp\n\n";
- $totalcount = $totalcount + $count;
- if($count == 0){
- print_r($data);
- }
- }while($count > 0);
- echo "Collected " . $totalcount . " plurks!";
- print_r($usercount);
- ?>
- </pre>
Add Comment
Please, Sign In to add comment