cURL error 6: Could not resolve host when trying toaccess data from my other laravel project

$response = Illuminate\Support\Facades\Http::get(config('pos.url').'/api/v2/modules');
$data = $response->json(); 

This is my code. I am trying to access data for this url but I get this error:

cURL error 6: Could not resolve host: thesuperstarshop.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://thesuperstarshop.com/api/v2/modules

But in my localhost the same code runs

  • Where are you running this code now? Is it in a shared host? Seems like it could be a firewall error or maybe a DNS issue. Speak to the hosting company’ support to see if they are blocking outbound requests. Have you tried making curl request to other URLs from there? Also you didn’t share your curl code

    – 

  • yes. i request to other api’s ( just like mobile side and desktop side ) are running correctly but in another laravel project give this error

    – 

  • It works from here. Again I would suspect a firewall or DNS issue. Talk to the hosting company where your code is running from.

    – 

Leave a Comment