Page 1 of 1
IP address.
Posted: Sun Mar 31, 2013 12:10 pm
by zolysoftsolutions
Hello,
Is possibble to read the IP address allocated by ISP?
The internal IP address is in windows registry, but the external not.
I need to read to a variable in some way the IP address like the "whatismyipadress.com" retourned.
By example on local machine I have 192.168.1.6 and the IP allocated by ISP is 89.192.166.27 (retourned by whatismyipadress.com)
Best regards,
Zoli B.
Re: IP address.
Posted: Sun Mar 31, 2013 1:23 pm
by esgici
zolysoftsolutions wrote:Hello,
Is possibble to read the IP address allocated by ISP?
The internal IP address is in windows registry, but the external not.
I need to read to a variable in some way the IP address like the "whatismyipadress.com" retourned.
By example on local machine I have 192.168.1.6 and the IP allocated by ISP is 89.192.166.27 (retourned by whatismyipadress.com)
Best regards,
Zoli B.
Hi Zoli
First, happy birth day to you
38 is a good age, please yourself
Regarding your question :
We have a control @...IPADDRESS / DEFINE IPADDRESS control in HMG and two samples about it.
But sadly, I haven't any experience and I'm afraid that this isn't you are searching.
In other hand, as far as I know, under normal conditions, IP address of any machine is variable; for every Internet connection will be assigned a different address to your machine. For own a fixed IP adress you need to buy it.
Probably you know all of these; all my knowledge is this.
Regards
Re: IP address.
Posted: Sun Mar 31, 2013 2:55 pm
by zolysoftsolutions
Hello Esgici,
Thank you for the wishes and for your replay.
Really this is the challenge, because the IP may vary.
But I solved at the moment in my beginner way:
- I made a PHP script. Here the IP is read and written into a text file on http
- Before I need to use the remote IP, I launch the script trough an activex control (create the file), I download the text file and I store the content of the file into a variable
- in this way my problem is solved, but I think somebody have a shorter and faster solution for this.
Best regards,
Zoli B.
Re: IP address.
Posted: Sun Mar 31, 2013 7:09 pm
by mol
maybe try to catch tracert dos command and examine results this command sends to screen
Re: IP address.
Posted: Mon Apr 01, 2013 12:27 pm
by jayadevu
Hi,
Pls try the following working sample:
Code: Select all
function main
local cInternetIP := Ip_Externo()
cInternetIP := iif("Site" $ upper(cInterNetIP),cInterNetIP,;
"Internet IP is: "+cInterNetIP)
/*
if file("init.cld")
REQUEST HB_GT_WIN_DEFAULT
endif
*/
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 300 ;
HEIGHT 150 ;
ICON INTERNETIPICON ;
TITLE 'Internet IP Address' ;
MAIN ;
NOSIZE ;
NOMAXIMIZE ;
TOPMOST
@ 30,25 LABEL label_1 of Win_1 VALUE cInternetIP ;
WIDTH 250 ;
BORDER ;
BOLD ;
font "Arial" SIZE 11 ;
CENTERALIGN ;
CLIENTEDGE ;
TOOLTIP "Your internet IP"
@ 80,90 BUTTON button_1 of Win_1 CAPTION "Ok " ACTION Win_1.Release ;
TOOLTIP "Click OK to exit"
END WINDOW
Win_1.Center
ACTIVATE WINDOW Win_1
return NIL
FUNCTION IP_EXTERNO()
local url, html, vRet
url := "http://checkip.dyndns.org/" //'http://meuip.datahouse.com.br/ automation.whatismyip.com/n09230945.asp'
html:= ReadPage_ler( url )
memowrit(GetMyDocumentsFolder()+"\InterNetIPInfo.html",dtoc(date())+" "+time()+" ["+html+"]")
vRet := PegaIP_ex(html) //vRET:= html //
RETURN iif(empty(vRET),"Site Not Reachable!",vRet)
FUNCTION PegaIP_ex(cHtml)
LOCAL Pos, PosF
Pos := At(':', Upper(cHtml) )
IF Pos < 1
RETURN 0
ENDIF
* Pos += Len('IP?')
cHtml := subst( cHtml, Pos+1 )
PosF := At('<',Upper(cHtml)) - 1
cHtml := Subst(cHtml,1,PosF)
RETURN alltrim(cHtml)
FUNCTION ReadPage_ler( cUrl )
LOCAL oUrl, oCli, cRes := ''
BEGIN SEQUENCE
oUrl = TUrl():New( cUrl )
IF EMPTY( oUrl )
BREAK
ENDIF
oCli = TIpClientHttp():New( oUrl )
IF EMPTY( oCli )
BREAK
ENDIF
oCli:nConnTimeout = 20000
IF !oCli:Open( oUrl )
BREAK
ENDIF
cRes := oCli:Read()
oCli:Close()
END SEQUENCE
RETURN cRes
Re: IP address.
Posted: Tue Apr 02, 2013 6:18 am
by zolysoftsolutions
Hi jayadevu!
It works! Thank you very much.. is more simple and more proffesionist than my solution. : )
Best regards,
Zoli B.