Find my IP Address?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Find my IP Address?
For a 4 year old thread, this actually peaked my interest, although I am unlikely to ever use this information. I mostly found out that without having your own server, it is (nearly) impossible for a client computer to get it's own external i.p. address as Richard points out.
If you do have a server, it becomes fairly easy, either through Lc, php, or the like. What is left for you to figure out is whether the server can be on the same network or not, at least none of the information I readily came across indicated one or the other.
And of course there are the less overpowering 3rd parties that were being asked to avoid, such as this one, which appears to be pretty nice in that it has a lot of options and it only returns text so you don't have to parse half the planet.
IF you are on a linux box, I found you could install dig (or similar) and query open.dns (which has since been aquired by Oracle (ewwww) . It makes me wonder if that would work with other dns solutions, I suspect it would.
All in all, pretty interesting stuff.
If you do have a server, it becomes fairly easy, either through Lc, php, or the like. What is left for you to figure out is whether the server can be on the same network or not, at least none of the information I readily came across indicated one or the other.
And of course there are the less overpowering 3rd parties that were being asked to avoid, such as this one, which appears to be pretty nice in that it has a lot of options and it only returns text so you don't have to parse half the planet.
IF you are on a linux box, I found you could install dig (or similar) and query open.dns (which has since been aquired by Oracle (ewwww) . It makes me wonder if that would work with other dns solutions, I suspect it would.
All in all, pretty interesting stuff.
Re: Find my IP Address?
Hi,
For checking the functionality of your DynDNS, for pinging/ portscanning yourself from the outside, for finding your clients data in the log on a remote server etc. etc.
Quite some services exist out there that offer this service - google "my IP" ;-)
But all of them cease to function as soon as I finally can remember their name, and nearly all of them require some parsing when queried via code.
So I usually have a button "Test connectivity" in any of my IN dependent programs. It answers the external IP that I get via a little "myip.php" script that resides besides the "index.html" on the customers server.
So I can get:
- my external IP
- knowledge if I have IN and
- knowledge if the server is up
all at once. Handy.
myip.php:
In LC I call a function:
Have fun!
There's quite many possibilities why you would want to know your external IP:FourthWorld wrote:The bigger question here is: why is the address needed?
For checking the functionality of your DynDNS, for pinging/ portscanning yourself from the outside, for finding your clients data in the log on a remote server etc. etc.
Quite some services exist out there that offer this service - google "my IP" ;-)
But all of them cease to function as soon as I finally can remember their name, and nearly all of them require some parsing when queried via code.
So I usually have a button "Test connectivity" in any of my IN dependent programs. It answers the external IP that I get via a little "myip.php" script that resides besides the "index.html" on the customers server.
So I can get:
- my external IP
- knowledge if I have IN and
- knowledge if the server is up
all at once. Handy.
myip.php:
Code: Select all
<?PHP
function getUserIP()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];
if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}
else
{
$ip = $remote;
}
return $ip;
}
$user_ip = getUserIP();
echo $user_ip; // Output IP address [Ex: 177.87.193.134]
?>
Code: Select all
function INTest withTime
-- put "myDomain.org/myip.php" into gName_IPURL
if withTime then -- return IP & latency
put the millisecs into t1
put url gName_IPURL into myIP
put the millisecs - t1 into t2
return myIP & CR & t2
else -- return IP only
return url gName_IPURL
end if
end INTest
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: Find my IP Address?
Well said AxWald !AxWald wrote:Hi,
There's quite many possibilities why you would want to know your external IP:
For checking the functionality of your DynDNS, for pinging/ portscanning yourself from the outside, for finding your clients data in the log on a remote server etc. etc.
One way to do it without the need to install,
set up and manage your own server,
and all in a couple of minutes ... thanks LiveCode.
Code: Select all
on check_myIP
if matchText( URL "http://www.query-ip.com", \
"(?ms)<input\s+class=.mdl-textfield__input.+?\svalue=.([\d.]+).\s+name" \
, myIP \
)
then answer "Your IP is: " & myIP
else answer "Sorry, doesn't work :("
end check_myIP
done in a couple of minutes with 1 test.
You have been warned!
Disclaimer2:
Of course, if the html of query-ip.com changes later on,
this script has to be update too.
Have fun too
Thierry
Last edited by Thierry on Sat Sep 09, 2017 9:23 am, edited 1 time in total.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- VIP Livecode Opensource Backer
- Posts: 9852
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Find my IP Address?
It seems I'm a less clear writer than I'd hoped. When I asked "why is the address needed?" I didn't mean to imply that no such need was possible. It's a big world; all things are possible. I'm merely interested in the use case which prompted this thread.
Being such an old thread we may never learn that, but it's precisely because we can imagine such a broad range of scenarios that choosing a good solution for Newbie4 requires us to consider his project's specific needs.
Moreover, what we've seen in the solutions offered here is that each of them requires a server, something the OP was hoping to avoid.
Even Thierry's most recent solution, useful as it is, relies on a server (query-ip.com). On the one hand, at least it's not a server one needs to maintain, but on the other hand it's not a sever one can maintain: as we've seen in the first suggestion in this thread of relying on a third-party service (qery.us), we have no guarantees about how long any third-party service will remain active and available.
For specialized intermediate-level admin tasks like those AxWald suggested (DynDNS, pen-testing, monitoring), there can be some good value in obtaining external IP address, but at that skill level it seems more likely one would just put a one-line PHP or LC Server script on an external server and be done with it.
The most common use case I've seen for requests about obtaining one's own external IP is P2P. But there are reasons most of the industry's interest in P2P peaked around the turn of the century, and since then things have been thriving around client-server clouds.
But I'm just guessing. Without input from Newbie4, there's no way to know whether his interest was in P2P, external monitoring, or something else.
At least in the interim we've collected a wide range of useful options in case anyone needs them.
Being such an old thread we may never learn that, but it's precisely because we can imagine such a broad range of scenarios that choosing a good solution for Newbie4 requires us to consider his project's specific needs.
Moreover, what we've seen in the solutions offered here is that each of them requires a server, something the OP was hoping to avoid.
Even Thierry's most recent solution, useful as it is, relies on a server (query-ip.com). On the one hand, at least it's not a server one needs to maintain, but on the other hand it's not a sever one can maintain: as we've seen in the first suggestion in this thread of relying on a third-party service (qery.us), we have no guarantees about how long any third-party service will remain active and available.
For specialized intermediate-level admin tasks like those AxWald suggested (DynDNS, pen-testing, monitoring), there can be some good value in obtaining external IP address, but at that skill level it seems more likely one would just put a one-line PHP or LC Server script on an external server and be done with it.
The most common use case I've seen for requests about obtaining one's own external IP is P2P. But there are reasons most of the industry's interest in P2P peaked around the turn of the century, and since then things have been thriving around client-server clouds.
But I'm just guessing. Without input from Newbie4, there's no way to know whether his interest was in P2P, external monitoring, or something else.
At least in the interim we've collected a wide range of useful options in case anyone needs them.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Find my IP Address?
The webservice above doesn't work anymore for international IP addresses
this one here seems to:
put URL "(a p i .ipify . org" into" into globalIP
Note: I had to remove the htt... because of forum rules
returns just a simple IP address
Does anyone know a webservice like this that returns a user location if someone is using a windows machine. Android is simple , but a webservice will be great as a backup incase geolocation is switched off. Need it for security logs.
this one here seems to:
put URL "(a p i .ipify . org" into" into globalIP
Note: I had to remove the htt... because of forum rules
returns just a simple IP address
Does anyone know a webservice like this that returns a user location if someone is using a windows machine. Android is simple , but a webservice will be great as a backup incase geolocation is switched off. Need it for security logs.
Re: Find my IP Address?
http://economy-x-talk.com/ip.php has been up since 2005.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 9852
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Find my IP Address?
Thanks Mark. Is there a tutorial there on how to obtain one's IP address from script?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Find my IP Address?
Sir?FourthWorld wrote: ↑Thu Jan 09, 2020 4:32 pmThanks Mark. Is there a tutorial there on how to obtain one's IP address from script?
Does:
Code: Select all
...
put URL("http://economy-x-talk.com/ip.php") into fld "my own IP address"
...
-
- VIP Livecode Opensource Backer
- Posts: 9852
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Find my IP Address?
Thanks, Klaus. There are many such services around, it didn't occur to me that Mark was offering his as a scalable solution for everyone to use.
For those looking for a code example for making your own solution, see my earlier post in this very old thread:
https://forums.livecode.com/viewtopic.p ... 02#p157955
For those looking for a code example for making your own solution, see my earlier post in this very old thread:
https://forums.livecode.com/viewtopic.p ... 02#p157955
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn