get your external IP

Post Reply
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

get your external IP

Post by Jimmy »

hi,

Code: Select all | Expand

curl -4 ifconfig.co/json
or try
https://ifconfig.co/
greeting,
Jimmy
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: get your external IP

Post by nageswaragunupudi »

Nice, thanks.

Using this info

Code: Select all | Expand

function PublicIP()
return BeforAtNum( "</span>", AfterAtNum( [-ip">], WebPageContents( "https://ifconfig.co/" ), 1 ), 1 )
Regards

G. N. Rao.
Hyderabad, India
Enrrique Vertiz
Posts: 549
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Contact:

Re: get your external IP

Post by Enrrique Vertiz »

Greetings, question and how will the IPV4 be obtained?
Thank you
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.09, BCC74, MySQL 8.0.X, SQLLIB 1.9m
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: get your external IP

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Enrrique Vertiz
Posts: 549
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Contact:

Re: get your external IP

Post by Enrrique Vertiz »

Gracias !!!
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.09, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Enrrique Vertiz
Posts: 549
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Contact:

Re: get your external IP

Post by Enrrique Vertiz »

Saludos Antonio

Para obtener la direccion IP local utilizo: GetHostByName( GetHostName() ) y en Win10 funcion Ok, el resultado lo comprado con IpConfig y me da lo mismo.
Pero con Win11, me da un valor distinto al que me retorna IpConfig ... creo que algo ahi no esta Ok ...
Gracias
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.09, BCC74, MySQL 8.0.X, SQLLIB 1.9m
User avatar
anserkk
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: get your external IP

Post by anserkk »

I am using Windows 11 Pro, Version 23H2

I am getting the local IP via GetHostByName( GetHostName() )
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: get your external IP

Post by nageswaragunupudi »

Code: Select all | Expand

GetHostByName( GetHostName() )
gives us the local IP of our PC in the Local Area Network.
Not the Public IP of our router
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: get your external IP

Post by Antonio Linares »

Fixed for Windows 11. Solucionado:

Se incluye en el próximo build de FWH

Code: Select all | Expand

function LocalIP()

   local cIP

   WSASTARTUP()
   cIP = GetHostByName( GetHostName() )
   WSACLEANUP()

return cIP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: get your external IP

Post by nageswaragunupudi »

Simple

Code: Select all | Expand

function PublicIP()
return WebPageContents( "https://www.fivetechsoft.com/getip.php" )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: get your external IP

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: get your external IP

Post by Silvio.Falconi »

I allready Used

Function GetIP()
Local cVar1
WsaStartUp()
cVar1 := GetHostByName( GetHostName() )
WsaCleanUp()
return cVar1
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Post Reply