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

jmurphy1267's avatar

cURL error 6: Could not resolve host

I am trying to make a a login method that returns a password grant token to the user to use with an iPhone app. I am using Guzzle like this

$response = $http->post('http://www.srty.test/oauth/token', [
            'form_params' => [
                'grant_type' => 'password',
                'client_id' => env('PASSWORD_GRANT_CLIENT'),
                'client_secret' => env('PASSWORD_GRANT_SECRET'),
                'username' => request('email'),
                'password' => request('password'),
                'scope' => '',
            ],
        ]);

calling it I get this error cURL error 6: Could not resolve host but the URL is a valid url

0 likes
4 replies
Talinon's avatar

Can you show the code where you instantiate $http?

Cronix's avatar

Can you ping that host from the same box? I assume since it's a (local) .test domain, you're on the same domain when sending the guzzle request to it?

kossa's avatar

I have the same error, did you find a solution ?

Please or to participate in this conversation.