Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

前端 未结 14 2317
盖世英雄少女心
盖世英雄少女心 2020-11-21 17:37

Because of the Twitter API 1.0 retirement as of June 11th 2013, the script below does not work anymore.

// Create curl resource 
$ch = curl_init(); 
// Set u         


        
14条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-21 17:54

    First of all I wanted to thank jimbo and (his post / twitter-api-php simple library).

    If you are going to use the GET search/tweets API with "twitter-api-php" PHP library (TwitterAPIExchange.php):

    First, you have to just comment "Perform a POST request and echo the response " code area.

    Just use "Perform a GET request and echo the response" code and echo the response and change these two lines:

    $url = 'https://api.twitter.com/1.1/followers/ids.json';
    $getfield = '?screen_name=J7mbo';
    

    to

    $url = 'https://api.twitter.com/1.1/search/tweets.json';
    $getfield = '?q=J7mbo';
    

    (Change screen_name to q, that's it :)

提交回复
热议问题