Laravel Guzzle无法解析主持人

时间:2017-03-13 16:15:39

标签: php laravel curl laravel-5 guzzle

我有一个Laravel应用程序,它本地托管在本地IP上。

它将始终在IP内部托管。

我正在尝试将我的应用程序连接到Interlinks API,发送$ client-> post()我收到以下错误:

  

CurlFactory.php第186行中的ConnectException:cURL错误6:无法   解析host:headers(参见   http://curl.haxx.se/libcurl/c/libcurl-errors.html

以下是我的控制器中的代码。

$client = new \GuzzleHttp\Client();

        $client->setDefaultOption('headers', array('Accept' => 'application/json', 'Content-Type' => 'application/json', 'GEOSESSION' => 'MTAuMjYuMy43asdasdasdasdTky'));
        $body = json_encode($job);

        $res = $client->post('https://api.interlinkexpress.com/shipping/shipment',['body' => $body]);

        dd($res);

有没有人有任何想法,为什么我无法解决主机?我希望这与当地人无关。

由于

1 个答案:

答案 0 :(得分:0)

尝试使用最新的Guzzle(目前为6.2)。

您似乎使用的是旧版本,因为setDefaultOption中没有6.x