FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour get your external IP
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
get your external IP
Posted: Sun May 05, 2024 04:24 PM
hi,
Code (fw): Select all Collapse
curl -4 ifconfig.co/json
or try
https://ifconfig.co/
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: get your external IP
Posted: Mon May 06, 2024 01:30 AM
Nice, thanks.

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



G. N. Rao.

Hyderabad, India
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: get your external IP
Posted: Mon May 06, 2024 03:11 AM

Greetings, question and how will the IPV4 be obtained?

Thank you

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: get your external IP
Posted: Mon May 06, 2024 03:22 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: get your external IP
Posted: Mon May 06, 2024 03:34 AM

Gracias !!!

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: get your external IP
Posted: Mon May 06, 2024 03: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 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: get your external IP
Posted: Mon May 06, 2024 04:43 AM

I am using Windows 11 Pro, Version 23H2

I am getting the local IP via GetHostByName( GetHostName() )

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: get your external IP
Posted: Mon May 06, 2024 08:09 AM
Code (fw): Select all Collapse
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: get your external IP
Posted: Mon May 06, 2024 08:25 AM
Fixed for Windows 11. Solucionado:

Se incluye en el próximo build de FWH
Code (fw): Select all Collapse
function LocalIP()

   local cIP

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

return cIP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: get your external IP
Posted: Mon May 06, 2024 08:40 AM
Antonio Linares wrote:https://www.fivetechsoft.com/getip.php
Simple
Code (fw): Select all Collapse
function PublicIP()
return WebPageContents( "https://www.fivetechsoft.com/getip.php" )
Regards



G. N. Rao.

Hyderabad, India
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: get your external IP
Posted: Mon Jun 03, 2024 06:07 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: get your external IP
Posted: Mon Jun 03, 2024 08: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 March-April 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

Continue the discussion