我正在尝试获得我传入的用户名的朋友。不会起作用的,我已经试过我能想到的一切了。请看一看,给我一些建议:
虽然它没有给出任何错误,但仍显示一个空白页面。不回显用户名。
include 'lib/EpiCurl.php';
include 'lib/EpiOAuth.php';
include 'lib/EpiTwitter.php';
include 'lib/secret.php';
$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
$oauth_token = 'xxxx'; //Yes I filled these out in the actual code
$oauth_token_secret = 'xxxx'; //Yes I filled these out in the actual code
$twitterObj->setToken($oauth_token, $oauth_token_secret);
$twitterInfo= $twitterObj->get_accountVerify_credentials();
$twitterInfo->response;
$twitterUsername = $twitterInfo->screen_name;
getFriends('csti');
function getFriends ($username){
global $twitterObj, $oauth_token, $oauth_token_secret, $twitterUsername;
$twitterFriends = $twitterObj->get('/statuses/friends.json');
$twitterFriends->response; //not sure if this is necessary but doesnt work either way.
try{
foreach($twitterFriends as $friend) {
echo $friend->screen_name;
}
}catch(EpiTwitterException $e){
echo $e->getMessage();
}
} 发布于 2011-08-18 14:53:32
您的代码中有一些奇怪的地方。
您传递了参数$username和字符串'csti',但是您似乎没有在函数中的任何地方使用它。
https://stackoverflow.com/questions/7102707
复制相似问题