Hi all,
I need to send an http request (GET method) like this:
http://softwarexp.co.uk/?id=test&psw=test&Msg=xxxxx .. ......
How can I send this request and manage the return code via FWH ?
Thanks in advance.
Marco Turco wrote:How can I send this request and manage the return code via FWH ?
STATIC FUNCTION RUNURL( cUrl, cErr )
LOCAL oUrl, oCli
LOCAL lOk := .F.
cErr = ""
BEGIN SEQUENCE
oUrl = TUrl():New( cUrl )
IF EMPTY( oUrl ); BREAK; ENDIF
oCli = TIPClientHttp():New( oUrl )
IF EMPTY( oCli ); BREAK; ENDIF
oCli:nConnTimeout = -1
IF !oCli:Open(); BREAK; ENDIF
cErr = CVALTOCHAR( oCli:ReadAll() )
lOk = !EMPTY( oCli:cReply ) .AND. "OK" $ UPPER( oCli:cReply )
oCli:Close()
END SEQUENCE
RETURN lOk
Enrico Maria Giordano wrote:I don't know how to get the result code, though.
Enrico Maria Giordano wrote:I'm using the following function to run an URL, return the result page and eventually the error message. I don't know how to get the result code, though.
- Code: Select all Expand view
STATIC FUNCTION RUNURL( cUrl, cErr )
LOCAL oUrl, oCli
LOCAL lOk := .F.
cErr = ""
BEGIN SEQUENCE
oUrl = TUrl():New( cUrl )
IF EMPTY( oUrl ); BREAK; ENDIF
oCli = TIPClientHttp():New( oUrl )
IF EMPTY( oCli ); BREAK; ENDIF
oCli:nConnTimeout = -1
IF !oCli:Open(); BREAK; ENDIF
cErr = CVALTOCHAR( oCli:ReadAll() )
lOk = !EMPTY( oCli:cReply ) .AND. "OK" $ UPPER( oCli:cReply )
oCli:Close()
END SEQUENCE
RETURN lOk
EMG
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 108 guests