Background :
My apache webserver runs on two virtual host with two different IP address. I have whitelisted both of these IPs to the remote SMPP server/system. I would be communicating to the remote server from a single machine which has these two IP addresses.
Situation :
I am trying to open a socket connection to a remote SMPP server. But I want to initiate connection to the server from different IP address.
What I tried :
I created two folders mkdir /var/www/html/server{1,2}
and added following lines to my http.conf
Listen 1.1.1.1:80
Listen 2.2.2.2:80
<VirtualHost 1.1.1.1:80>
DocumentRoot /var/www/html/server1
</VirtualHost>
<VirtualHost 2.2.2.2:80>
DocumentRoot /var/www/html/server2
</VirtualHost>
and in each folder I write the same php file which opens a socket connection and does whatever it is supposed to do. I will be moving the server2 and the second IP on a new machine. But before doing that, I just want to know for sure that the second IP is actually whitelisted and I will be able to communicate via that IP.
Question :
When you fsockopen
inside PHP , what IP address is sent to the remote server? will it be same as $_SERVER['SERVER_ADDR']
or something else ?
Note on IPs :
I saw couple of answers mentioning actual IP address of my machine. Assume that I have two eth cards, providing me with two, i.e., eth0 and eth1 interfaces with 1.1.1.1 and 2.2.2.2 IP addresses. Both are linked to external world and I can call my machine by any of the address. So if your answer is something along the lines of actual-public-linked-up-ip-address-of-your-server please tell me which one 1.1.1.1 or 2.2.2.2 ? How do you decide which one is actual and which one is virtual ?