I have a web server with 2 IP One for connecting to the internet, one for VPN… i want to detect ip that i get from the vpn.. variable $_SERVER[‘SERVER_ADDR’] only detect my ip to connet to the internet is there any technique to detect ip from the vpn? please help me… Andre
I forgot there is a simple program named ipconfig in windows and ifconfig in *nix.
With that simple program, i can parse my VPN IP using output of exec() function that calling ipconfig or ifconfig.
The difficulty is when i use exec function in the iis environtment... That function need permission.
Here is the example code [exec function in iis]:
<i> </i>$runCommand = "ipconfig.exe"; $WshShell = new COM("WScript.Shell"); $output = $WshShell->Exec($runCommand)->StdOut->ReadAll; //the $output is the output of the ipconfig execution in command prompt
You need copy the ipconfig.exe in your local web directory. Otherwise you need to add the location of the file and do not forget to set the permission.
In the *nix environment, that execution simply create by using backtick operator.
After the execution, time for parsing the IP using regex...