我正在使用以下代码在 Twitter 的 API 上进行搜索:
$.post('lib/themattharris-tmhOAuth-38bd48b/search.php',
       {q:'@something',
       pages:'1'}
)
.done(function(xhr) {
    try 
    {
        var tweets = $.parseJSON(xhr.responseText);
    }
    catch (e)
    {
        showError('Error : '+e.message);
        return;
    }
    if (tweets === null)
    {
        showError('Error : no tweets found');
        return;
    }
    $('#timeline').text(tweets.results[0].text);
})
.fail(function(xhr, textStatus, errorThrown) {
    showError('Error : ' + $.parseJSON(xhr.responseText).error);
})
.always(function() {
    $('#load').removeAttr('disabled');
});
但“推文”总是null。Mysearch.php进行搜索并简单地回显结果。我检查了jsonlint返回的 JSON ,没有发现错误。
有什么线索吗?
编辑这里是search.php:
    require_once 'tmhOAuth.php';
    require_once 'tmhUtilities.php';
    require_once 'secrets.php';
    session_start();
    $tmhOAuth = new tmhOAuth(array(
      'consumer_key'    => $consumerKey,
      'consumer_secret' => $consumerSecret,
      'user_token'      => $_SESSION['access_token']['oauth_token'],
      'user_secret'     => $_SESSION['access_token']['oauth_token_secret']
    ));
    $p['q'] = $_POST['q'];
    $p['pages'] = 1;
    $p['include_entities'] = 'true';
    $pages = intval($p['pages']);
    $results = array();
    $code = $tmhOAuth->request(
      'GET',
      'http://search.twitter.com/search.json',
      $p,
      false
    );
    if ($code !== 200) {
        header("HTTP/1.1 500 Internal Server Error");
        echo $tmhOAuth->response['response'];
        return;
    }     
    else
    {
        echo $tmhOAuth->response['response'];
    }