Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ssuhat's avatar

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

On my development my code is working properly. When I push to my server it become error.

cURL error 6: Could not resolve host: http (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Here is my code:

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('/');
}

Any solution?

Thanks

0 likes
12 replies
poxin's avatar

Can you ping or telnet to the API server from yours?

1 like
30lines's avatar

I agree with @ajzo, had to restart nginx server through Forge to get it to start working again.

codeclimber's avatar

Hey @ajzo @30lines I had the same problem a few days ago and again today. I am not on Digital Ocean but on Amazon aws or maybe does forge use Digital Ocean for DNS?

ederrafo's avatar

Hello guys

I had that problem and it was because of my virtual machine, I resolved simply add that host in my etc/hosts

:V

jdiaz's avatar

How do you add the host to etc hosts?

skeith22's avatar

just add the server IP just like on your windows host file.

ssh on your server and run this command on your server

homestead or ubuntu server

sudo nano /etc/hosts

on windows edit the host file *note you need to open the text editor as administrator

C:\Windows\System32\drivers\etc

on your host file write this *192.168.10.10 is your server address. your server IP may be different

192.168.10.10    project.test
192.168.10.10    project2.test
192.168.10.10    project3.test

or

127.0.0.1    project.test
127.0.0.1    project2.test
127.0.0.1    project3.test
2 likes

Please or to participate in this conversation.