如何获得?我试着运行这段代码没有用,
这是我的简单代码,此代码不起作用
include_once('twitteroauth.php');
$consumerkey = "xxx";
$consumersecret = "xxx";
$accesstoken = "xx";
$accesstokensecret = "xx";
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$result = $connection->get("https://api.twitter.com/1.1/followers/list.json?screen_name=keanei&count=100");
// create an array to store the retrieved followers
$newFollowers = array();
foreach ($result->users as $follower) {
$id = $follower->id;
$name = mysql_real_escape_string($follower->name);
$screen_name = mysql_real_escape_string($follower->screen_name);
$newFollowers[$id] = array('screen_name'=>$screen_name, 'username'=>$name);
echo"$screen_name";
}
感谢您的帮助:)