Hi all,
plz help to translate this piece of code into Fivewin,
FUNCTION MyWanIP
LOCAL oHTTP as "winhttp.winhttprequest.5.1"
LOCAL cHTML
oHTTP=NEWOBJECT("winhttp.winhttprequest.5.1")
oHTTP.Open("GET","http://www.ip-adress.com/",.f.)
oHTTP.Send()
cHTML = ohTTP.ResponseText
RELEASE oHTTP
RETURN STREXTRACT(cHTML,"My IP address: ","</h2>")
Thanks.
Regards
Hoe
translate code to fivewin : internet IP
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: translate code to fivewin : internet IP
Code: Select all
function MyWanIP
local oHttp, cHtml
oHttp := CreateObject( "winhttp.winhttprequest.5.1" )
oHttp:Open( "GET", "http://www.ip-adress.com/", .f. )
oHttp:Send()
cHtml := oHttp:ResponseText()
cHtml := StrExtract( cHtml, "My IP address: ", "</h2>" )
msginfo( cHtml )
return cHtml
static function StrExtract( cText, cAfter, cBefore )
local cRet := SubStr( cText, At( cAfter, cText ) + Len( cAfter ) )
local n
if ( n := At( cBefore, cRet ) ) > 0
cRet := Left( cRet, n - 1 )
endif
return cRet
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: translate code to fivewin : internet IP
ok, thanks a lot.