External API connection failures can be related to server networking, DNS resolution, SSL verification, or restrictions imposed by the hosting provider.
Start by checking the following:
- Verify that the API endpoint is correct.
- Check whether the hosting server can resolve the API domain.
- Confirm that outbound connections to the required port are allowed.
- Check whether the external API blocks requests from your hosting server's IP address.
- Verify that your application is using valid HTTPS certificates.
- Review the application logs for the exact network error.
You can test DNS resolution from the cPanel terminal:
nslookup api.example.com
If DNS works but the connection still fails, ask your hosting provider whether outbound connections to that API's port are restricted.