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 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符