get your external IP

get your external IP

Postby Jimmy » Sun May 05, 2024 4:24 pm

hi,

Code: Select all  Expand view
curl -4 ifconfig.co/json

or try
https://ifconfig.co/
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: get your external IP

Postby nageswaragunupudi » Mon May 06, 2024 1:30 am

Nice, thanks.

Using this info
Code: Select all  Expand view
function PublicIP()
return BeforAtNum( "</span>", AfterAtNum( [-ip">], WebPageContents( "https://ifconfig.co/" ), 1 ), 1 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: get your external IP

Postby Enrrique Vertiz » Mon May 06, 2024 3:11 am

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
Enrrique Vertiz
 
Posts: 541
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru

Re: get your external IP

Postby Antonio Linares » Mon May 06, 2024 3:22 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: get your external IP

Postby Enrrique Vertiz » Mon May 06, 2024 3:34 am

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

Re: get your external IP

Postby Enrrique Vertiz » Mon May 06, 2024 3:51 am

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
Enrrique Vertiz
 
Posts: 541
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru

Re: get your external IP

Postby anserkk » Mon May 06, 2024 4:43 am

I am using Windows 11 Pro, Version 23H2

I am getting the local IP via GetHostByName( GetHostName() )
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: get your external IP

Postby nageswaragunupudi » Mon May 06, 2024 8:09 am

Code: Select all  Expand view
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
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: get your external IP

Postby Antonio Linares » Mon May 06, 2024 8:25 am

Fixed for Windows 11. Solucionado:

Se incluye en el próximo build de FWH

Code: Select all  Expand view
function LocalIP()

   local cIP

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

return cIP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: get your external IP

Postby nageswaragunupudi » Mon May 06, 2024 8:40 am



Simple
Code: Select all  Expand view
function PublicIP()
return WebPageContents( "https://www.fivetechsoft.com/getip.php" )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: get your external IP

Postby Antonio Linares » Mon Jun 03, 2024 6:07 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: get your external IP

Postby Silvio.Falconi » Mon Jun 03, 2024 8:39 am

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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 45 guests