Telegram-bot-sdk: Got "cURL error 6: Could not resolve host: api.telegram.org" Error

Created on 14 Nov 2016  路  4Comments  路  Source: irazasyed/telegram-bot-sdk

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

Most helpful comment

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?

All 4 comments

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

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

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?

Yes! It helps! Seems it works properly now!

Thank you very much. I'm appreciated!

Kind regards,
Chaska

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mccarlosen picture mccarlosen  路  3Comments

wlinh picture wlinh  路  3Comments

maminbajand picture maminbajand  路  4Comments

hafezd picture hafezd  路  3Comments

jobs2008 picture jobs2008  路  3Comments