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

Daniel1836's avatar

How to pull data from an API (Video Game Aggregator Lesson)

I'm looking at the Video Game Aggregator Laracast lesson.

https://laracasts.com/series/build-a-video-game-aggregator

I cloned the GitHub repository and started the server.

The page booted up, but then it redirected to this exception:

Illuminate\Http\Client\ConnectionException
cURL error 6: Could not resolve: api-v3.igdb.com (DNS query cancelled) (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

It's trying to pull data from the IGDB web site. I didn't alter the code.

How do I resolve this?

0 likes
2 replies
aurawindsurfing's avatar

Hey @daniel1836

Now this might seem like too simple to be true but what I have been using lately is simple Laravel build in Http client: https://laravel.com/docs/8.x/http-client

you can simply use it like this:

 $response = Http::post(env('PLAID_ENV') . '/transactions/get', [
            'client_id'    => env('PLAID_CLIENT_ID'),
            'secret'       => env('PLAID_SECRET'),
            'access_token' => $this->access_token,
            'start_date'   => '2018-01-01',
            'end_date'     => '2020-12-31',
        ]);

the you do:

$response->json();

Hope it helps!

Daniel1836's avatar

I resolved the connection issue. Now I have an authorization issue. I think it involves the key used to access this IGDB API. The exception I get is this:

GuzzleHttp\Exception\ClientException
Client error: `POST https://api.igdb.com/v4/multiquery` resulted in a `401 Unauthorized` response: {"message":"Unauthorized"}

I'm following the directions from https://api-docs.igdb.com/#account-creation I registered and got a key.

The way I understand you just paste the IGDB_KEY inside the .env file. (which I did) Is there more to it than that?

It also generates a client id. I haven't looked into using that. I'm not sure where it goes.

Please or to participate in this conversation.