Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got "cURL error 6: Could not resolve host: api.telegram.org" Error #293

Closed
chaskayu opened this issue Nov 14, 2016 · 4 comments
Closed

Got "cURL error 6: Could not resolve host: api.telegram.org" Error #293

chaskayu opened this issue Nov 14, 2016 · 4 comments

Comments

@chaskayu
Copy link

Hi Everyone,

I'm developing a telegram bot and it has been smoothly so far. But the error below suddenly occurs and I couldn't find any solution to fix it... Can anyone help?

Fatal error: Uncaught exception 'Telegram\Bot\Exceptions\TelegramSDKException' with message 'cURL error 6: Could not resolve host: api.telegram.org (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in /var/sentora/hostdata/xxxxxx/public_html/_telegram/vendor/irazasyed/telegram-bot-sdk/src/HttpClients/GuzzleHttpClient.php:114 Stack trace: #0 /var/sentora/hostdata/xxxxxx/public_html/_telegram/vendor/irazasyed/telegram-bot-sdk/src/TelegramClient.php(117): Telegram\Bot\HttpClients\GuzzleHttpClient->send('https://api.tel...', 'POST', Array, Array, 60, false, 10) #1 /var/sentora/hostdata/xxxxxx/public_html/_telegram/vendor/irazasyed/telegram-bot-sdk/src/Api.php(1014): Telegram\Bot\TelegramClient->sendRequest(Object(Telegram\Bot\TelegramRequest)) #2 /var/sentora/hostdata/xxxxxx/public_html/_telegram/vendor/irazasyed/telegram-bot-sdk/src/Api.php(958): Telegram\Bot\Api->sendRequest('POST', 'sendMessage', Array) #3 /var/sentora/hostdata/xxxxxx/public_html/_telegram/vendor/irazasyed/telegram-bot-sdk/src/Api.php(303): Telegram in /var/sentora/hostdata/xxxxxx/public_html/_telegram/vendor/irazasyed/telegram-bot-sdk/src/HttpClients/GuzzleHttpClient.php on line 114

Thank you so much!

Kind regards,
Chaska

@ItsOnlyMeNL
Copy link

ItsOnlyMeNL commented Nov 14, 2016

You should check your /etc/resolv.conf if you are running linux.

make sure you have at least 2 nameservers in there:

nameserver 8.8.8.8
nameserver 4.2.2.1

@chaskayu
Copy link
Author

Hi,

Thank you for replying!

I've just checked the resolv.conf you that mentioned and there are below nameservers:

nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888
nameserver 8.8.8.8

I tried to add nameserver 4.2.2.1 back but it was removed after I rebooted the server...

Any action should I take next?

Thank you so much!

Kind regards,
Chaska

@ItsOnlyMeNL
Copy link

You don't need to reboot the server if u add a new nameserver to the resolv.conf . Adding them should be enough

Try setting the IPv4 nameservers at the top and then IPv6.

so:

nameserver 8.8.8.8
nameserver 4.2.2.1
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888

then save the file and make it read only:
chattr +i /etc/resolv.conf

to remove the read only:
chattr -i /etc/resolv.conf

Does this help?

@chaskayu
Copy link
Author

Yes! It helps! Seems it works properly now!

Thank you very much. I'm appreciated!

Kind regards,
Chaska

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants