dongshang4984 2014-02-25 09:39
浏览 163
已采纳

如何从我的主页获取推文

I am new in twitter Api ... but i read some in the documentations.

Now in my twitter account i have followers and they tweets displayed in my home page.

I want using PHP get all tweets that displayed in my home page ... all what i can do so far to get my tweets only.

$url = "https://api.twitter.com/1.1/statuses/user_timeline.json";

// Make Requests
$header = array(buildAuthorizationHeader($oauth), 'Expect:');
$options = array( CURLOPT_HTTPHEADER => $header,
              CURLOPT_HEADER => false,
              CURLOPT_URL => $url , 
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_SSL_VERIFYPEER => false);

$feed = curl_init();
curl_setopt_array($feed, $options);
$json = curl_exec($feed);
curl_close($feed);

$twitter_data = json_decode($json);

thanks,

  • 写回答

2条回答 默认 最新

  • dsizmmwnm56437180 2014-02-25 10:09
    关注

    You can use home_timeline.json instead of user_timeline.json";

    $url = "https://api.twitter.com/1.1/statuses/home_timeline.json";
    
    // Make Requests
    $header = array(buildAuthorizationHeader($oauth), 'Expect:');
    $options = array( CURLOPT_HTTPHEADER => $header,
                  CURLOPT_HEADER => false,
                  CURLOPT_URL => $url , 
                  CURLOPT_RETURNTRANSFER => true,
                  CURLOPT_SSL_VERIFYPEER => false);
    
    $feed = curl_init();
    curl_setopt_array($feed, $options);
    $json = curl_exec($feed);
    curl_close($feed);
    
    $twitter_data = json_decode($json);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?