Finnhub-Stock-API / finnhub-php

Finnhub PHP API client. Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals and alternative data. https://finnhub.io/docs/api
Apache License 2.0
23 stars 19 forks source link

Fatal error: Uncaught Finnhub\ApiException: [0] cURL error 6: Could not resolve host: finnhub.io #1

Open OnceWasPerfect opened 4 years ago

OnceWasPerfect commented 4 years ago

Hello,

I use your api to pull a stock quote every few seconds. I had it all working yesterday and this morning I loaded up my test site and got the error in the title. The code i'm using is this:


   require_once('../vendor/autoload.php');
    require('functions.php');

    $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKey('token', 'my api key');
    $client = new Finnhub\Api\DefaultApi(new GuzzleHttp\Client(), $config);

    $q = $_REQUEST['q'];

    echo formatUSD($client->quote($q)->getc());

The formatUSD is just a little function I made to display it as money. I did also try without that function just to make sure it wasn't causing an error somehow.

The rest of the error references lines 9698 and 9674 in DefaultApi.php.

Thank you!

Edit: removed my api key but it is there in my code

nongdenchet commented 4 years ago

regarding to your error: Could not resolve host: finnhub.io it could be there is an outage from the server at that time. CC: @finnhubio can you have a look?

OnceWasPerfect commented 4 years ago

Thanks for getting back with me. It is still giving this error several days later. I don't think finnhub is down as I can use their code directly and get a response.

nongdenchet commented 4 years ago

Hi @OnceWasPerfect sorry for late response, let us help a look