View Full Version : How to setup a click event to pull current local IP and external IP
slafta
02-09-2005, 04:44 AM
Sorry this might not be possible but is there a way to click on an icon to dispaly the current IP address. IF so good..
second if that is possible is there a way the pull an external IP though that command as well.
longedge
02-09-2005, 05:26 AM
Check out the System.GetLANInfo action which returns a table one of the items of which is the IP address.
You need the Pro version of AMS5
TJ_Tigger
02-09-2005, 07:11 AM
second if that is possible is there a way the pull an external IP though that command as well.
when you ay external IP address, is it another NIC in your PC or are you referring to a firewall/router box that is providing NAT? If so, I am not aware of a way to pull that information. If AMS could communicate via SNMP and your router had SNMP you could potentially use that.
Another route is to use the AMS HTTP actions to try and login securly to the router and obtain the IP address that way. But I don't know if it will be easy or possible.
Tigg
You could use a web object and go to a site like:
http://www.findmyip.com
then parse the source for your extrernal IP.
TJ_Tigger
02-09-2005, 08:46 AM
In looking at the source to see how it is formatted, I found this
<!-- Please do not "script" this site without permission -->
<!-- Your IP address is:<br>127.0.0.1</FONT> -->
<!-- Please do not "script" this site without permission -->
So I guess if you go that route, Please do not "script" this site without their permission.
Looks like you would have to do a lot of scripting since they display your IP address with gif files. But the nice thing is that the name of the gifs are "1default.gif", "2default.gif", "3default.gif" etc or ".default.gif"
Tigg
longedge
02-09-2005, 01:28 PM
It would be helpful to know what the scenario behind this is. A DNS lookup would be more helpful would be my guess unless were talking about a machine IP and a network gateway 'outward facing' IP perhaps.
TJ_Tigger
02-09-2005, 02:08 PM
This site returns information in the title bar of the window.
http://www.whatismyip.com/
Tigg
sside
02-09-2005, 02:48 PM
Here (http://applications.ssideproject.com/downloads/Findmyip.zip) you have a application i did which will find your wan ip and host.
TJ_Tigger
02-09-2005, 03:50 PM
Here (http://applications.ssideproject.com/downloads/Findmyip.zip) you have a application i did which will find your wan ip and host.
Can you share your project or how you accomplished the task?
Thx
Intrigued
02-09-2005, 06:24 PM
Hey! What's my blood type doing in that list! (just'a kiddin') ;)
That works like a champ. Thanks for sharing sside!
:yes
sside
02-09-2005, 06:29 PM
Button On Click
url = Web.GetURL("Web1");
if (url ~= "") then
if (url ~= "http://www.yoursite.com/script.php") then
strurl = String.Replace(url, "http://www.yoursite.com/script.php?ip=", "", false);
strwanip = String.Find(strurl, "?", 1, false);
strhost = String.Find(strurl, "=", 1, false);
wanip = String.Left(strurl, strwanip-1);
host = String.Mid(strurl, strhost+1, -1);
Input.SetText("InputLANIP", System.GetLANInfo().IP);
Input.SetText("InputWANIP", wanip);
Input.SetText("InputHOST", host);
end
end
PHP Script
<?php
if (!$ip)
{
$ip = $_SERVER['REMOTE_ADDR'];
$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo '<meta **********="refresh" content="0;URL=http://www.yoursite.com/script.php?ip='.$ip.'?host='.$host.'">';
}
?>
TJ_Tigger
02-10-2005, 08:59 AM
Thanks sside, I figured it had to be a script on a remote server. Very nice. Gives me some good ideas for things I have wanted to do.
Tigg
Derek
02-10-2005, 09:04 AM
I looked at doing something that required LAN/WAN IP addresses recently. Now I know where to go on that one, thanks :)
[just need to get a script server set up! :rolleyes ]
sside
02-10-2005, 11:27 AM
Intrigued, Tigg, Derek, you're welcome. I hope you find this useful.
slafta
02-12-2005, 10:12 PM
code the php site be executed locally, here is the scenario, i want to on click pull the values, and write to text files,
thanks
nirus
02-14-2005, 05:29 PM
php is server side scripting, you can not run it "locally" unless you have a version of php installed and then you have to have something like apache to run the modules of php. You could grab the source code for apache and php and cut it down to only contain what you want. It has been known to make apache and php as little as 500k. But that is a whole other topic for C development.
Just set up a website and put this php file there:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "$ip";
?>
No need for any parsing
Nirus
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.