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 on different ports, like port 8080 or 3000.
- Game servers.
- Remote MySQL or other database servers.
- FTP servers.
- SMTP servers on ports other than 587, like 25 or 465.
Additional ports cannot be opened on request.
Sending email with PHPMailer or a similar library? Make sure you use port 587 with STARTTLS (
tlsencryption). Many examples use port 465, which won’t work.
Which services are blocked?
Some services are blocked entirely because of abuse, even on the allowed ports:
- Discord (including webhooks and bots)
- Telegram (including bots)
- Cloudflare Workers
- Google Apps Script
Connections to these services will fail. Consider upgrading to premium hosting if you need to access these services, or use an alternative service to the ones listed above.
What errors will I see?
Blocked ports
Connections to blocked ports are not refused, they time out. Your page may load for a long time before you see an error like one of these:
cURL error 28: Connection timed out after 10001 millisecondscURL error 7: Failed to connect to example.com port 3306 after 130000 ms: Connection timed outfsockopen(): Unable to connect to example.com:21 (Connection timed out)file_get_contents(https://example.com:8080/): Failed to open stream: Connection timed outSMTP ERROR: Failed to connect to server: Connection timed out (110)(PHPMailer)
If you see a timeout, check which port your code connects to. If it’s not 80, 443 or 587, the connection is blocked.
Blocked services
Blocked services may not resolve at all, so you’ll see an error about the host name instead:
cURL error 6: Could not resolve host: discord.comphp_network_getaddresses: getaddrinfo for discord.com failed: Name or service not known
These errors can also be caused by a typo in the host name, so double check the address first. If the address is correct and the service is on the list above, it’s blocked.
Using a library like Guzzle or Laravel’s HTTP client? These wrap cURL, so the error message usually contains one of the cURL errors above.
Can I get a fixed IP address for outbound connections?
No. Outbound connections from your website don’t come from a fixed IP address, and IP allowlisting for outbound connections is not supported.
You can check which IP address your website currently uses with a PHP file containing:
<?php echo file_get_contents('https://ifconfig.me');
However, this IP address is shared with many other websites and can change at any time. So you cannot use it to allowlist your website with an API, payment provider, database server or other service that requires a fixed IP address.