translate code to fivewin : internet IP

translate code to fivewin : internet IP

Postby tnhoe » Fri May 29, 2009 5:49 pm

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

Re: translate code to fivewin : internet IP

Postby nageswaragunupudi » Sat May 30, 2009 1:05 am

Code: Select all  Expand view
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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: translate code to fivewin : internet IP

Postby tnhoe » Mon Jun 01, 2009 5:41 am

ok, thanks a lot.
Regards

Hoe, email: easywin3@yahoo.com
User avatar
tnhoe
 
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 103 guests