Could someone show me how to save the content of a internet page to a variable.
Thanks in advance
Otto
FUNCTION MAIN()
? GETURL( "http://www.emagsoftware.it/gratis.htm" )
RETURN NIL
FUNCTION GETURL( cUrl )
LOCAL cFile := SUBSTR( cUrl, RAT( "/", cUrl ) + 1 )
LOCAL oUrl, oCli
LOCAL lOk := .F.
BEGIN SEQUENCE
oUrl = TUrl():New( cUrl )
IF EMPTY( oUrl ); BREAK; ENDIF
oCli = TIPClientHttp():New( oUrl )
IF EMPTY( oCli ); BREAK; ENDIF
IF !oCli:Open(); BREAK; ENDIF
IF !oCli:ReadToFile( cFile ); BREAK; ENDIF
lOk = "OK" $ UPPER( oCli:cReply )
oCli:Close()
IF !lOk; FERASE( cFile ); ENDIF
END SEQUENCE
RETURN lOk
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 84 guests