PHP cannot resolve api.telegram.org on InfinityFree hosting

Website URL

https://t-bot.freedev.app/

Error Message

php_network_getaddresses: getaddrinfo for api.telegram.org failed: Name or service not known

Other Information

PHP cannot resolve api.telegram.org — Telegram webhook setup fails

Welcome to the InfinityFree community forum! Good to have you here.

  • Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
  • Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
  • AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
  • Solving an issue is a joint effort. Try the suggestions you get and report back what happened.

Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.

Yes, this looks like a deliberate restriction. Access to the Telegram API is blocked on our free hosting, so api.telegram.org won’t resolve from PHP even though it opens fine in your browser. A staff answer in a very similar topic says the block is there because of abuse and spam.

That answer also says receiving webhooks and API requests from anywhere isn’t supported on our hosting. So a Telegram webhook pointing at your site wouldn’t work either, not just the outgoing call.

The same answer says iFastNet’s premium hosting doesn’t have these two restrictions. It recommends asking them first if you plan to move a project there.

The staff answer is in this topic:

I don’t have a supported workaround for you.

As the bot said the telegram API is blocked due to historic abuse.