[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Getting Internal/Router IP in PHP/Javascript/etc?

Posted on 2011-09-18
3
Medium Priority
?
340 Views
Last Modified: 2012-05-12
I'm talking about those generic IPs that  router gives out, like 192.168.1.1 or 192.168.2.200 for example. From reading online alot of people state it is impossible, however, 'http://www.whatsmyip.org/more/' will give out the router IP, for example mine, on that website states 'Internal (LAN) IP: 192.168.1.68', which is correct.

I'm not certain how this can be replicated, I'm not looking for the real IP, I am looking the the internal/router IP. Any suggestions on how this can be achieved?

Right now using basic PHP/Javascript, can call any apache vars if needed too.
0
Comment
Question by:Valleriani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 668 total points
ID: 36557824
It's a server variable, $_SERVER['REMOTE_ADDRESS'].   They are listed there.  This short PHP page will show all the $_SERVER variables that are available from your server.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHP Server Variables</title>
</head>
<body><h1>PHP Server Variables</h1>
<?php

//reset($_SERVER);
foreach($_SERVER as $key => $value) {
    echo "<b>$key :</b> $value<br />\n";
}
echo "<hr>";
echo "<b>ENVironment variables.</b><br>";
foreach($_ENV as $key => $value) {
    echo "<b>$key :</b> $value<br />\n";
}

?>
</body>
</html>

Open in new window

0
 
LVL 14

Assisted Solution

by:Scott Madeira
Scott Madeira earned 668 total points
ID: 36557849
For the internal address you can use the script from this site:

http://www.reglos.de/myaddress/MyAddress.html

It has a MyAddress.class Java program will get the local IP address (192.168.1.x, for example.)

Here is a link to a demo page that gets the address of your computer.  http://www.reglos.de/myaddress/demo3.html


This is what the whatsmyip.org site uses.

Hope that helps.
0
 
LVL 7

Assisted Solution

by:boon86
boon86 earned 664 total points
ID: 36557865
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question