donglu9898 2013-06-06 18:05
浏览 98
已采纳

Twitter搜索API没有结果

I have a PHP script that uses the Twitter Search API to find tweets matching a search but for some reason is no longer working and is not returning any results.

Does anyone know what is going wrong?

<?php   

$search=json_decode(file_get_contents('https://search.twitter.com/search.json?q='.urlencode($_GET[q]).'%20vine.co%2Fv%2F&result_type=recent&include_entities=1&rpp=9&page='.$_GET[page]));
foreach($search->results as $result){
 foreach($result->entities->urls as $url){
   echo $url->expanded_url;
 }
}

?>
  • 写回答

1条回答 默认 最新

  • dongzhen7108 2013-06-06 21:36
    关注

    A Bug

    There's currently a bug in the 1.0 API - see this bug report. Anyway, unauthenticated requests will stop working in four days.

    Deprecated (and retired) 1.0 API

    Twitter requires you to use authenticated requests (OAuth) because, five days from now, the v1.0 API will be removed completely.

    What this means for you is that a simple:

    file_get_contents( . . . )
    

    ... well, for the 1.0 api, it'll just stop returning data! Five days from now, you won't be able to use that any more!

    See this post I posted today for a little background information and proof of the API removal date (five days from now).

    See this post for a walk through of how to make authenticated requests using Twitter's 1.1 API. It's pretty simple if you use this library and only a few lines of code to make the actual request.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)