Laravel-带有参数的枪口发布请求

时间:2020-05-16 08:54:03

标签: json laravel guzzle guzzle6

我正试图从耗时的请求中接收json响应,但我不明白我是否对此有误,或者这是API供应商的问题。

第一

use GuzzleHttp\Client;

这是我在Boats Controller中的代码

public function index()
{
$client = new Client();
$res=$client>post("http://ws.nausys.com/CBMSexternal/rest/catalogue/v6/charterBases",
                [
                'auth' =>  ['*****@****', '********'],
                'headers' => [ 'Content-Type' => 'application/json']
                ]);
echo $res->getBody();

}

在web.php中路由

//Ruote Boats
Route::get(LaravelLocalization::transRoute('routes.boats'),('Boats@index'), function () {
});

客户端错误:POST http://ws.nausys.com/CBMS-external/rest/catalogue/v6/charterBases 导致400 Bad Request响应:DOCTYPE html PUBLIC “-// W3C // DTD XHTML 1.0 Strict // EN” “ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>

0 个答案:

没有答案