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');
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