需要帮助获得Twitter用户的朋友;Epiphany RESTful PHP框架


Need help with getting friends of Twitter user; using PHP and Epiphany RESTful PHP Framework

我正在尝试获得我正在传递的用户名的朋友。不会成功的,我已经试过了我能想到的一切。请过目并给我一些建议:

虽然没有错误,但是显示一个空白页。不回显用户名。

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();  
    }
}  

你的代码有点奇怪。

您传递参数$username和字符串'csti',但您似乎没有在函数的任何地方使用它。