Guzzle返回cURL错误3:< url>畸形 [英] Guzzle returns cURL error 3: <url> malformed

查看:7671
本文介绍了Guzzle返回cURL错误3:< url>畸形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想试用图片库,并通过他们的

  $ client-> setDefaultOption(
'verify',
'C: \Program Files(x86)\Git\bin\curl-ca-bundle.crt'
);


I want to try out the guzzle library and am following through their quickstart tutorial to make http requests to an api.

Yet it doesn't seem to work, because I get the following error:

cURL error 3: <url> malformed

Since I have never worked with cURL before, I don't even know how to respond to that error message. Here is my code with the request I am making:

    $client = new Client();
    $client->get('/', ['verify' => true]);

    $response = $client->get('https://api.github.com/');

    dd($response);

I am using the Laravel 5 framework and calling the index method in my HomeController. Also am using WAMP.

I would appreciate any help and suggestion, because I would like to try Guzzle out.

Here is a picture of the Error Message I get:

解决方案

If you want to disable verification (don't do this!):

$response = $client->get('https://api.github.com/', ['verify' => false]);

Rather than disabling verification entirely, this can likely be fixed by providing proper CA bundle file. See verify in Guzzle documentation.

$client->setDefaultOption(
    'verify', 
    'C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt'
);

这篇关于Guzzle返回cURL错误3:&lt; url&gt;畸形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆