Advertisement
Neolot

Счетчик Twitter с кэшированием

Jan 28th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. // Счетчик Twitter с кэшированием
  2.  
  3. function nlt_getTwitterCounter($userID='androidbar') {
  4.     $output = get_transient('twitter_counter');
  5.     if ( $output === false || $output == '' ) {
  6.         $data = json_decode(@file_get_contents('http://api.twitter.com/users/' . $userID .'.json'));
  7.         $output = $data->followers_count;
  8.         set_transient( 'twitter_counter', $output, 60*10 );
  9.     }
  10.     echo $output;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement