400 API上的错误请求

时间:2014-01-16 18:06:21

标签: php google-oauth

当我向https://www.googleapis.com/adsense/v1.3/adclients/XXX/adunits?key=XXX发出请求时,我收到“400错误请求”错误。

这是回复:

object Google_HttpRequest (10) {
    private batchHeaders -> array(4) [
        'Content-Type' => string (16) "application/http"
        'Content-Transfer-Encoding' => string (6) "binary"
        'MIME-Version' => string (3) "1.0"
        'Content-Length' => string (0) ""
    ]
    protected url -> string (118) "https://www.googleapis.com/adsense/v1.3/adclients/XXX/adunits?key=XXX"
    protected requestMethod -> string (3) "GET"
    protected requestHeaders -> array(1) [
        'authorization' => string (84) "Bearer XXX"
    ]
    protected postBody -> NULL
    protected userAgent -> string (27) "google-api-php-client/0.6.5"
    protected responseHttpCode -> integer 400
    protected responseHeaders -> array(10) [
        'content-type' => string (31) "application/json; charset=UTF-8"
        'date' => string (29) "Thu, 16 Jan 2014 17:52:09 GMT"
        'expires' => string (29) "Thu, 16 Jan 2014 17:52:09 GMT"
        'cache-control' => string (18) "private, max-age=0"
        'x-content-type-options' => string (7) "nosniff"
        'x-frame-options' => string (10) "SAMEORIGIN"
        'x-xss-protection' => string (13) "1; mode=block"
        'server' => string (3) "GSE"
        'alternate-protocol' => string (8) "443:quic"
        'transfer-encoding' => string (7) "chunked"
    ]
    protected responseBody -> string (176) "{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyExpired",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}
"
    public accessKey -> NULL
}

我使用the official PHP library并在开发者控制台中一切正常......

0 个答案:

没有答案