【发布时间】:2017-10-25 00:52:30
【问题描述】:
我这样尝试邮递员:
我只填写输入密码。然后我点击按钮更新请求
这样的观点:
这是标题:
这是身体。我选择这样的原始数据和输入数据:
然后我点击按钮发送,它可以得到响应
但是当我尝试像这样使用 guzzle 6 时:
public function testApi()
{
$requestContent = [
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json'
],
'json' => [
'auth' => ['', 'b0a619c152031d6ec735dabd2c6a7bf3f5faaedd'],
'ids' => ["1"]
]
];
try {
$client = new GuzzleHttpClient();
$apiRequest = $client->request('POST', 'https://myshop/api/order', $requestContent);
$response = json_decode($apiRequest->getBody());
dd($response);
} catch (RequestException $re) {
// For handling exception.
}
}
结果为空
我该如何解决这个问题?
【问题讨论】:
标签: php laravel api laravel-5.3 guzzle