Skip to content

Instantly share code, notes, and snippets.

@halka
Created May 2, 2009 06:15
Show Gist options
  • Save halka/105438 to your computer and use it in GitHub Desktop.
Save halka/105438 to your computer and use it in GitHub Desktop.
TwitterのAPIの残機を取得する
<?php
//TwitterのAPIの残機を取得する
require_once 'HTTP/Request.php';
define('user','userid');
define('pass','password');
$apilim='http://twitter.com/account/rate_limit_status.json';
$req=& new HTTP_Request($apilim);
$req->setBasicAuth(user,pass);
$req->sendRequest();
$result=$req->getResponseBody();
$xml=json_decode($result,true);
//var_dump($xml);
echo "のこり:".$xml['remaining_hits']."<br />\nリセット時間;".$xml['reset_time'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment