首页 > 解决方案 > Oauth 1.0 只返回一项

问题描述

我在 php 中使用 oauth 1.0 从 API 获取 json。我知道事实上有不止一件物品要退回,但我只得到一件。这是getLastResponse()问题所在还是可能是什么?我想返回整个 json 对象。

private function getEvents() {
  try {
    $oauth = new OAuth($this->oauth_Key, $this->oauth_consumer, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
    $oauth->fetch($this->api_url);

    $response_info = $oauth->getLastResponseInfo();
    header("Content-Type: {$response_info["content_type"]}");
    echo $oauth->getLastResponse();
  } catch(OAuthException $e) {
    echo "Exception caught!\n";
    echo "Response: ". $e->lastResponse . "\n";
  }
}

标签: phpoauth

解决方案


推荐阅读