translate code to fivewin : internet IP

Post Reply
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

translate code to fivewin : internet IP

Post by tnhoe »

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
Regards

Hoe, email: easywin3@yahoo.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: translate code to fivewin : internet IP

Post by nageswaragunupudi »

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
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Re: translate code to fivewin : internet IP

Post by tnhoe »

ok, thanks a lot.
Regards

Hoe, email: easywin3@yahoo.com
Post Reply