# PHP cURL connection to api.yani.tv times out

**URL:** <https://forum.infinityfree.com/t/php-curl-connection-to-api-yani-tv-times-out/121732>\
**Category:** Hosting Support\
**Created:** [November 1, 2026, 6:33pm UTC](https://forum.infinityfree.com/t/php-curl-connection-to-api-yani-tv-times-out/121732 "2026-11-01T18:33:18Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Lemni](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lemni/32/68303_2.png) [@Lemni](https://forum.infinityfree.com/u/Lemni)\
**Post date:** [November 1, 2026, 6:33pm UTC](https://forum.infinityfree.com/t/php-curl-connection-to-api-yani-tv-times-out/121732/3 "2026-11-01T18:33:35Z")

</div>

_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._

Port 443 isn’t the problem. Our knowledge base says outbound connections are allowed on ports 80, 443 and 587, and blocked ports time out instead of being refused. Your request goes to 443, so the port isn’t what’s blocking it. The article also lists the services we block entirely, and `api.yani.tv` isn’t on that list.

The article is here:

> [@Can I connect to other servers from my website? (Sockets, cURL and APIs)](https://forum.infinityfree.com/docs?topic=49348):
>
> Your website can connect to other servers, for example to call an API, load data from another website or send email through an external SMTP server. This works with functions like cURL, file\_get\_contents() and fsockopen(). However, to prevent abuse, outbound connections are limited to a small set of ports and services. Which ports can I use? Port Used for 80 HTTP 443 HTTPS 587 SMTP (sending email) All other ports are blocked. This means you cannot connect to things like: APIs …

The “after 4001 milliseconds” in your error looks like a 4-second connect timeout set in your own code, probably `CURLOPT_CONNECTTIMEOUT` or `CURLOPT_TIMEOUT`. The 502 and the `X-Upstream-*` headers look like they come from your script, not from our platform. So the request is probably just taking longer than 4 seconds to connect from here.

Can you raise the connect timeout to something like 15–20 seconds and tell me whether the request then succeeds? Please also post the raw `curl_errno()` and `curl_error()` output, not your script’s wrapped message. That would show whether it’s a plain timeout or a DNS or connection error.

To check whether the problem is specific to that API, you could also run a small PHP file containing `<?php echo file_get_contents('https://ifconfig.me');`. If that works, outbound HTTPS from your site is fine.

---

_[View the full topic](https://forum.infinityfree.com/t/php-curl-connection-to-api-yani-tv-times-out/121732)._
