I am working on a project where we have a server (linux box) that will have multiple IP addresses. The application I'm building will need to connect to remote machines using cURL and, depending on some condition to be determined in PHP, a particular IP address must be used to connect to the remote machine. Is this possible? I've been looking at the curl_setopt option 'CURLOPT_INTERFACE' which appears to let me specify which IP to use when connecting.
For instance, my application extracts some values from a database that have been entered by an admin. These values instruct my application to connect to one of 3 remote machines. If I connect to machine 1, it will only speak to my server if my computer's HTTP request comes from IP 11.11.11.11. Computer 2, on the other hand, will only handle requests from IP 22.22.22.22. And computer 3 snubs everyone but 33.33.33.33.
Or something like that. The bottom line is that the server on which my application runs will have all these IPs assigned to it (11.11.11.11, 22.22.22.22, 33.33.33.33) and it should use one or the other depending on which remote machine it's connecting to.