How to use cURL for a specific interface

I am developing code in c that is just FTP files on an FTP server using a curl utility, following this example

I now have one simple task: to tell curl to use a specific server interface (IP) to boot, since the other server interface is connected to a different socket connection.

Is there any way to do this?

+6
source share
2 answers

The --interface option --interface

 curl --interface eth0 
+14
source

Your request is to specify a server-side interface based on its IP, right? (and not your client side interface? in this later case, the waving option --interface <name> is fine)

Then you can use the IP address in the url.

Say 216.58.211.110 is google.com from my house, and then:

 $ curl http://216.58.211.110/index.html <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="http://www.google.com/index.html">here</A>. </BODY></HTML> 
-1
source

All Articles