首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要帮助获得推特用户的朋友;使用PHP和Epiphany RESTful PHP框架

需要帮助获得推特用户的朋友;使用PHP和Epiphany RESTful PHP框架
EN

Stack Overflow用户
提问于 2011-08-18 13:17:09
回答 1查看 262关注 0票数 0

我正在尝试获得我传入的用户名的朋友。不会起作用的,我已经试过我能想到的一切了。请看一看,给我一些建议:

虽然它没有给出任何错误,但仍显示一个空白页面。不回显用户名。

代码语言:javascript
复制
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();  
    }
}  
EN

回答 1

Stack Overflow用户

发布于 2011-08-18 14:53:32

您的代码中有一些奇怪的地方。

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7102707

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档