/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Detect VPN IP

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

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@andre4s_yauthorJun 11.2007 — Some how i find the way... ?

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-&gt;Exec($runCommand)-&gt;StdOut-&gt;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...

So.. that's it.. resolve.. ?
×

Success!

Help @andre4s_y spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...