Return to Snippet

Revision: 31605
at September 9, 2010 15:55 by zuzara


Initial Code
<?php
define('TWITTER_CONSUMER_KEY',      '');
define('TWITTER_CONSUMER_SECRET',   '');

$baseUrl = 'http://api.twitter.com/1/zuzara/in-japanese/members.json';
//  you will find tokens on My Access Token via http://dev.twitter.com/
$accessToken = '';
$accessTokenSecret = '';
 
$oauth = new OAuth(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
$oauth->setToken($accessToken, $accessTokenSecret);
$url = $baseUrl;
do {
    $oauth->fetch($url);
    $buf = $oauth->getLastResponse();
    $data = json_decode($buf, true);
    foreach ($data['users'] as $user) {
        echo $user['screen_name'], PHP_EOL;
    }
    $url = $baseUrl . '?cursor=' . $data['next_cursor'];
} while (!empty($data['next_cursor']));

Initial URL


Initial Description
To follow all of members in a list, you may want to use http://tweepml.org/

Initial Title
Get all members of twitter lists

Initial Tags
twitter

Initial Language
PHP