【发布时间】:2019-04-03 01:47:55
【问题描述】:
我正在尝试使用 Guzzle 获取 JSON 提要,这是我的第一次。
给我的身体样本是:
{
"auth": {
"key": "samplekeyhere",
"secret": "samplesecrethere"
}
}
这是我的代码:
$res = $client->request(
'GET',
'https://urltofeed',
[
"verify" => false, // JUST FOR TESTING NOW
"headers" => [
"Content-Type" => "application/json;charset=UTF-8"
],
"json" => [
"key" => "samplekeyhere",
"secret" => "samplesecrethere"
]
]
);
$body = $res->getBody();
$jsonResponse = json_decode($body);
var_dump($jsonResponse);
输出是:
status code is200object(stdClass)#2455 (2) { ["success"]=> bool(false) ["msg"]=> string(7) "Error 1" }
我的语法有问题还是我应该要求新的密钥和秘密?
【问题讨论】: