For the external, make sure a firewall is not blocking connections. Typically, you would use a proxy to connect to external websites from within an organization
For internal, ensure you have the right authorization headers. Typically organizations have LDAP or SAML authentication set up. This might be blocking your requests since the system is unable to authorize you.
Since I have no idea how your systems are setup, not sure if I can help beyond the above guesses.
when I put the full URL for external the response goes green with code=20
we are using LDAP authentication and I am pretty sure that it is the basic cause for blocking the request. can you please share the step for LDAP authorization. .
I used curl command with proxy and user credentaill but still using the error code 401