Get Public IP

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
PedroAlex
Posts: 231
Joined: Tue Feb 09, 2010 3:06 am

Get Public IP

#1 Post by PedroAlex »

Hello Comunity.

For anyone who has experience with work on the net, could give a hint on the best way to get the Public IP in an application xBase..

Thanks in advance.
Pedro
Pedro Alexandre

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Get Public IP

#2 Post by skiman »

Hi,

Something as:
cResult := loadfromurl("http://checkip.dyndns.org/")

cResult will contain the following: Current IP Address: 194.78.56.73

Then you can get the IP:
cMyIp := substr( cResult , at(":",cResult)+2)
or
cMyIp := dc_tokenarray(cResult,":")[2]
Best regards,

Chris.
www.aboservice.be

User avatar
PedroAlex
Posts: 231
Joined: Tue Feb 09, 2010 3:06 am

Re: Get Public IP

#3 Post by PedroAlex »

Hi Cris.
many thanks for feed Back.

LoadFromUrl() works well for me and even better with this link :

Function GetPublicIPAddress()
LOCAL cIP := LoadFromURL('http://ipecho.net/plain')
return cIP

Sounds like a good solution and does not need external Libs

However someone knows a more recent technique?

Thanks..
Pedro
Pedro Alexandre

Post Reply