In DirectAdmin I can assign an IP to a domain. I have 20 different IPs there. Can I somehow bind a given IP to a curl/wget/file_get_contents? I know what external IPs I have, but I don't know any internals, like interfaces.
1 Answers
Because it's not 100% clear from your question:
- If you need a solution for PHP/cURL, refer to the question Gabi linked to.
- If you want to do it with CLI curl, do
curl --interface INTERFACE
- If you want to do it with CLI wget, do
wget --bind-address=ADDRESS
Edit: To expand on the comment - It is my understanding that an "external IP" is an IP which is not addressable on the current machine. That means that either:
...the interface of the external IP lives on another system and some form of network-fu is happening between the two (or more) systems (like NAT)
or
...the system you have access to does not grant you access to a local interface by means of the OS and local network stack (network layers can be completely virtualized, for example)
In both cases you obviously can't bind to those interfaces. But to be sure, you will have to get a grasp of your hosters networking setup. If you don't specify an IP, which of the 20 does it use? Is it always the same one?
-
As I understand correctly for all of these I need to give either interface name like "eth0" or internal IP like "127.0.0.1" or "192.168.X.X". I don't know these. I have a list of 20 external IPs that I can use. I tried curl, wget and PHP with the external IPs but I didn't work. – Tom Aug 17 '15 at 10:50
-
It has an IP assigned by default and all crop/wget/file_get_contents use that IP. Seems I just cannot switch IPs here in PHP. Thanks for you answer! – Tom Aug 18 '15 at 15:51