How to resolve the error cURL Error: Failed to connect to port 80/443: Connection timed out?

If the code is with localhost you are able to connect to that URL and get the result, but when you are live with the same code then you get that error of port which means that port 80 and 443 at your hosting end is blocked which is resulting in connection time out.

Kindly contact your hosting partner and ask to unblock the same.

This also happens due to the firewall security setting to allow making the connection with the URL.

Please refer the link: