First of all, I am not an EXPERT in this subject..
Function OpenHTTP(cType)
LOCAL oHTTP
if (oHTTP := win_oleCREATEOBJECT('Msxml2.ServerXMLHTTP.6.0')) == NIL
? "ERROR.. Msxml2.ServerXMLHTTP.6.0 object creation failed.."
RETURN NIL
endif
return (oHTTP)
**--------------------------------------------------------------------------**
Function PostHTTP(oHTTP, cUrl, lGet)
local cRetVal := "", nCounter := 0, oErr
DEFAULT lGet to .f. // GET or POST
BEGIN SEQUENCE with {|oErr|break(oErr)}
if lGet
oHTTP:OPEN("GET", cUrl, .F.) // search
else
oHTTP:OPEN("POST", cUrl, .F.) // upload
endif
oHTTP:SEND()
do while nCounter < 500000
if oHTTP:ReadyState == 4
EXIT
endif
if nCounter > 100
? "[" + hb_ntos(nCounter) + "] HTTP ReadyState => " + hb_ntos(oHTTP:ReadyState) // just for info
endif
++nCounter
enddo
if ! oHTTP:status == 200
? "HTTP Status => [" + hb_ntos(oHTTP:Status) + "] " + oHTTP:StatusText
endif
cRetVal := oHTTP:responseText
cRetVal := strtran(cRetVal, chr(13))
RECOVER using oErr
cRetVal := alltrim(strtran(oErr:description, chr(13)))
hb_alert("Error occured while processing HTTP request :-" + ";;" + ;
cRetVal, NIL, "r/gr", 10)
cRetVal := ""
END SEQUENCE
if empty(cRetVal)
? "Empty Response Text from website.."
endif
return (cRetVal)
**--------------------------------------------------------------------------**
Read the ServerXMLHTTP help document from microsoft or others for using "Content-Type: multipart/form-data" and other settings ..
I am using url encoded string and this string is an extension to the server name. So I do not have to use parameters in SEND() method..
In your case, you need to use the SEND() method parameters to send data. Go through the OPEN(), GET & SEND() methods and sample codes..
Regards..