The most effective way to resolve curl to a different server is to use the
--resolve option. This option will insert the address into curl's DNS cache, so it will effectively make curl believe that's the address it got when it resolved the name.
curl --resolve eaxmple.com:80:184.108.40.206 http://example.com/
In the above example, firstly we specify the domain (example.com), then we ask it to connect on port 80 to the IP 220.127.116.11. Depending on the protocol used and the server's configuration, the port can vary. For HTTP the port is 80 and for HTTPS, the port is 443.
It is important to note here that the
--resolve option will send SNI for the name in the URL. This means that when connecting to the server via HTTPS, curl will verify the server's response to make sure it servers for the name in the URL. In other words, it will ensure there is an SSL on the server installed for the domain.