random error 'ERR_TLS_CERT_ALTNAME_INVALID'

I run a small script from shell to read PositionsRisk.
From time to time I’m getting this error:
‘ERR_TLS_CERT_ALTNAME_INVALID’, Hostname/IP does not match certificate’s altnames: Host: fapi.binance.com. is not in the cert’s altnames: DNS:bot111.com,
After e certain time the error disappears and the script works well.
When I run the same code from a webpage it works always fine.
I have no idea what could be the problem.

Interesting, seems an issue from domain name DNS parsing. Maybe you can try to change the network and try again.

One more thing. I copy the code and run it from a webpage. Then in works well. But from command prompt on server it gives error