Hi all,
I can get my external ip address with the code below.
I wonder if there is another way to get the external ip without connecting to any site.
Birol Betoncu
I can get my external ip address with the code below.
I wonder if there is another way to get the external ip without connecting to any site.
Birol Betoncu
#include "fivewin.ch"
function main()
LOCAL cRetIP:=''
RUNURL("http://www.whatismyip.com/automation/n09230945.asp", @cRetIP)
msginfo(cRetIP)
RETURN nil
FUNCTION RUNURL( cUrl, cErr )
LOCAL oUrl, oCli, lOk := .F.
cErr = ""
BEGIN SEQUENCE
oUrl = TUrl():New( cUrl )
IF EMPTY( oUrl ); BREAK; ENDIF
oCli = TIPClientHttp():New( oUrl )
IF EMPTY( oCli ); BREAK; ENDIF
oCli:nConnTimeout = -1
IF !oCli:Open(); BREAK; ENDIF
cErr = CVALTOCHAR( oCli:ReadAll() )
lOk = !EMPTY( oCli:cReply ) .AND. "OK" $ UPPER( oCli:cReply )
oCli:Close()
END SEQUENCE
RETURN lOk