The easiest way to connect via curl to a different server is to alter the hosts file on your machine.
On Linux and Unix systems, the hosts file is located in /etc/hosts, while on Windows systems it will be located in c:\windows\system32\drivers\etc\hosts.
Once you open the file with a text editor of your choice, add
1.2.3.4 domain.tld www.domain.tld
This is basically the IP of the server you would like to resolve the domain to followed by the domain and a www version of the domain.
Curl will then resolve to this domain until the added line in the hosts file is removed.
The limitation in this example is that editing the hosts file often requires admin access and also, it affects all applications connected to the domain at the same time.