php - Laravel guzzle cURL 错误 6 : Could not resolve host: http (see http://curl. haxx.se/libcurl/c/libcurl-errors.html)

标签 php laravel curl

在我的开发过程中,我的代码运行正常。当我推送到我的服务器时,它变成了错误。

cURL 错误 6:无法解析主机:http(请参阅 http://curl.haxx.se/libcurl/c/libcurl-errors.html)

这是我的代码:

use GuzzleHttp\Client;

try {
    $client = new Client();
    $client->request('POST', env('API_DOMAIN') . '/v1/user/auth/verified_email',
        ['headers' => ['Authorization' => 'cm9vcGlhLnVzZXIud2ViOkY0RVN3VXJheS1qVVB1a18='],
         'query'   => ['token' => $key]]);

    return redirect('/')->with('status', 'Your email has been verified. Thanks!')->with('statusType', 'success');
} catch (ConnectException $e) {
    Log::error($e);
    return redirect('/');
}

有什么解决办法吗?

谢谢

最佳答案

我的解决方案是清除 Artisan 中所有类型的缓存。

一起运行这些命令:

php artisan route:clear
php artisan config:clear
php artisan cache:clear

关于php - Laravel guzzle cURL 错误 6 : Could not resolve host: http (see http://curl. haxx.se/libcurl/c/libcurl-errors.html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38909026/

相关文章:

laravel - 是否可以将 artisan 添加到我的路径中,这样我就不必在 artisan 命令前面添加 'php'

Curl 无法解析 Elasticsearch 中的主机

php - GROUP BY 不起作用

php - 使用codeigniter上传文件时出错

php - OOP概念理解

php - laravel 我需要在 unique() 列上使用 index() 吗?

php - 多次更新查询

php - 使用未定义常量 App - 在 Laravel 中假设为 'App'

curl - 如何让curl忽略代理?

linux - 无法访问亚马逊服务上的某些网站