dongzhu6900 2011-05-24 14:20
浏览 55
已采纳

任何人都可以通过twitter home_timeline api帮助我吗?

I have the following code

    $curl_handle = curl_init();
    $api_url = 'http://api.twitter.com/1/statuses/home_timeline.json';
        curl_setopt($curl_handle, CURLOPT_URL, $api_url);
    if (true) {
        curl_setopt($curl_handle, CURLOPT_USERPWD, 'mytwitterusername:mypass');
    }
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Expect:'));
    $twitter_data = curl_exec($curl_handle);
    $this->http_status = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
    $this->last_api_call = $api_url;
    curl_close($curl_handle);
    var_dump($this->http_status);
    var_dump($twitter_data);
    return $twitter_data;

And it returns {"errors":[{"code":53,"message":"Basic authentication is not supported"}]}

Can anyone figure it out what is the problem. Thanks in advance..

  • 写回答

2条回答 默认 最新

  • dstjh46606 2011-05-24 14:22
    关注

    As the error message states, the problem is that basic authentication is not supported.

    You need to use OAuth to authenticate with Twitter.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料