Often I’ll run into a situation where I need to make an HTTP request for a host name against a server that is at a different IP address than the one the host name resolves to. A common reason for this is to test out changes against a sandbox before deploying the change to production.
curl – resolve google.com:443:184.108.40.206 https://www.google.com/
Internally curl will make sure that google.com resolves to 220.127.116.11 for the purposes of that request. No need to mess around with hosts files or anything else.
For more suggestions in this area check out curl another host.