2

I use the laravel HTTP client. Periodically there is an error cURL error 6: Could not resolve host, tell me how to fix it?

use Illuminate\\Support\\Facades\\Http;

$response = Http::get('http://example.com');

3 Answers 3

4

I think it is a network related problem. I guess your ISP cannot resolve "http://example.com". Your code is working on my environment!

On which OS you are trying to run this code?

On linux based OS and if you are using apache2 as web server you can try below steps:

Open resolv.conf

vi /etc/resolv.conf

Add these lines(Google nameservers) to the file

nameserver 8.8.8.8

nameserver 8.8.4.4

Then restart apache2

/etc/init.d/apache2 restart

Sign up to request clarification or add additional context in comments.

Comments

1

This is a problem with your system. You should autoload your packages. This may solve your problem. use this command

composer dump-autoload

Comments

0

in my case for some reason I set PUSHER_HOST=http in .env file. Removing the http and making it PUSHER_HOST= solved the issued.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.