Jump to content
Sign in to follow this  
sensalim

@IPAddress1 is incorrect

Recommended Posts

sensalim

How come @IPAddress1 is not the same as if I go to www.whatismyip.com?

Share this post


Link to post
Share on other sites
Jos

Your Thread title is misleading :)

To answer your question: My guess is that you are connected to the Internet via a NAT router meaning that your PC's NIC has a different IP address than your Public Internet Ip address since that address is assigned to your router.

;)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
sensalim

So there is no way to get the "whatismyip" IP?

Share this post


Link to post
Share on other sites
DW1

real quick and dirty:

#include <INet.au3>
#include <String.au3>
MsgBox(0, "from IPAddress1", @IPAddress1 )
$source = _INetGetSource( "http://whatsmyip.org" )
$IP = _StringBetween( $source, "Your IP is ", "</title>" )
MsgBox( 0, "From whatsmyip.org", $IP[0] )

I am sure there are about a hundred ways to do this better, but this is what I threw together real quick.

This will get the ip address returned from the site you mentioned.

EDIT: There will be ways to do this without connecting to an external site, maybe by connecting to the router, or telnet to the router... lol, or just wait for somebody that knows more than me to post :) where are you now Geo? Penguins? (the one time I actually want to see you correct me after I post LMAO)

Edited by danwilli

Share this post


Link to post
Share on other sites
sensalim

Thanks I'll try that.

I just noticed. You joined this forum 1 day before me and you already got 1022 post count - wow lol. :)

Edit:

It worked!

Edited by sensalim

Share this post


Link to post
Share on other sites
herewasplato

_GetIP() is included in v3.2.10.0

#include <Inet.au3>
$PublicIP = _GetIP()
MsgBox(0, "IP Address", "Your IP Address is: " & $PublicIP)

Edit: It pretty much does what danwilli wrote but it uses two sites in case one

is down.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
sensalim

Thanks, that one works too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×