使用示例应用Twitter API但返回Null

时间:2013-11-06 05:05:31

标签: php twitter

我正在使用twitter-api-php-master通过Twitter搜索关键字,但得到Null返回。真的不确定为什么会这样。

我的代码就像:

<?php

#### Include the class file ####

    require_once('TwitterAPIExchange.php');

#### Set access tokens ####

    $settings = array(
    'oauth_access_token' => "[something]",
    'oauth_access_token_secret' => "[something]",
    'consumer_key' => "[something]",
    'consumer_secret' => "[something]"
    );


$url = 'https://api.twitter.com/1.1/search/tweets.json';
$requestMethod = 'GET';

$getfield = '?q=test&geocode=37.781157,-122.398720,1mi&count=100';

$twitter = new TwitterAPIExchange($settings);
$response =  $twitter->setGetfield($getfield)
                 ->buildOauth($url, $requestMethod)
                 ->performRequest();
var_dump(json_decode($response));
?>

我几乎从https://github.com/J7mbo/twitter-api-php/wiki/Twitter-API-PHP-Wiki的例子中复制了这个。但结果只是空虚。有人知道这是什么问题吗?

0 个答案:

没有答案