You are on page 1of 2

FUNCTION wsapi(oUrl,oMethod,oParam)

PUBLIC oHTTP as "WinHTTP.WinHTTPRequest.5.1"


TEXT TO lcparam NOSHOW TEXTMERGE PRETEXT 7
<<oparam>>
ENDTEXT

lcurl=oUrl
oHTTP = CreateObject("WinHTTP.WinHTTPRequest.5.1")
oHTTP.Open(oMethod, lcurl, .F.)
oHttp.SetTimeouts(0, 60000, 30000, 120000)
oHTTP.setrequestheader('Content-Type', 'application/x-www-form-urlencoded;')
oHTTP.Send(lcParam)

oHTTP.status
lcrespons = oHTTP.responseText
lcjson=nfJsonRead(m.lcRespons)
RETURN lcjson
ENDFUNC

FUNCTION wsinacbg(oUrl,oMethod,oParam)
PUBLIC oHTTP as "WinHTTP.WinHTTPRequest.5.1"

TEXT TO lcparam NOSHOW TEXTMERGE PRETEXT 7


<<oparam>>
ENDTEXT

lcurl=oUrl
oHTTP = CreateObject("WinHTTP.WinHTTPRequest.5.1")
oHTTP.Open(oMethod, lcurl, .F.)
oHttp.SetTimeouts(0, 60000, 30000, 120000)
oHTTP.setrequestheader('Content-Type', 'application/x-www-form-urlencoded;')
oHTTP.Send(lcparam)

oHTTP.status
lcrespons = oHTTP.responseText
lcrespons=nfJsonRead(m.lcRespons)
RETURN lcrespons
ENDFUNC

FUNCTION wsinacbgx(oUrl,oMethod,oParam)
PUBLIC oHTTP as "WinHTTP.WinHTTPRequest.5.1"

TEXT TO lcparam NOSHOW TEXTMERGE PRETEXT 7


<<oparam>>
ENDTEXT

lcurl=oUrl
oHTTP = CreateObject("WinHTTP.WinHTTPRequest.5.1")
oHTTP.Open(oMethod, lcurl, .F.)
oHttp.SetTimeouts(0, 60000, 30000, 120000)
oHTTP.setrequestheader('Content-Type', 'application/x-www-form-urlencoded;')
oHTTP.Send(lcparam)

oHTTP.status
lcrespons = oHTTP.responseText
*lcrespons=nfJsonRead(m.lcRespons)
RETURN lcrespons
ENDFUNC
FUNCTION oCtoD(oTgl)
lctahun = GETWORDNUM(oTgl,1,'-')
lcbulan = GETWORDNUM(oTgl,2,'-')
lchari = GETWORDNUM(oTgl,3,'-')
tanggal = CTOD(lchari+'/'+lcbulan+'/'+lctahun)
RETURN tanggal
ENDFUNC

FUNCTION oDtoT(oTgl)
***
* oDtot('20170101')
* return YYYY-MM-DD hh:mm:ss
***
mTime = TIME()
loDtot =
LEFT(ALLTRIM(oTgl),4)+"-"+SUBSTR(ALLTRIM(oTgl),5,2)+'-'+RIGHT(ALLTRIM(oTgl),2)+'
'+mTime
RETURN loDtot
ENDFUNC

FUNCTION bacatext
Local gnFileHandle,nSize,cString
gnFileHandle = FOPEN("url.txt")
* Seek to end of file to determine number of bytes in the file.
nSize = FSEEK(gnFileHandle, 0, 2) && Move pointer to EOF
IF nSize <= 0
* If file is empty, display an error message.
WAIT WINDOW "This file is empty!" NOWAIT
ELSE
* If file is not empty, store the file's contents in memory
* and display the text in the main Visual FoxPro window.
= FSEEK(gnFileHandle, 0, 0) && Move pointer to BOF
cString = FREAD(gnFileHandle, nSize)
ENDIF
= FCLOSE(gnFileHandle) && Close the file
RETURN cString
ENDFUNC

You might also like