当我使用 Postman 时,它可以完美运行。但是,如果我在 PHP 中使用相同的标头,则会出现504 Gateway Time-out
错误。
这就是我调用请求的方式:
$headers = [
'Authorization' => 'Bearer ' . $this->getAccessToken(),
'Cache-Control' => 'private',
'Transfer-Encoding' => 'chunked',
'Content-Type' => 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8',
'Content-Encoding' => 'gzip',
'Vary' => 'Accept-Encoding',
'x-ms-ags-diagnostic' => '{"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"003","RoleInstance":"AGSFE_IN_12","ADSiteName":"WEU"}}',
'Preference-Applied' => 'odata.track-changes',
'OData-Version' => '4.0'
];
$request = $this->guzzle->get('v1.0/me/calendarview/delta?startdatetime=2019-12-12T00:00:00Z&enddatetime=2019-12-13T00:00:00Z', ['headers' => $headers]);
print_r($request->getBody());
一旦我更改Transfer-Encoding
为chunked
(就像在 Postman 中一样),我就会收到网关错误。如果我不使用它,我就不会得到日历事件。