Posted by: shree5 January 2, 2006
Login in to Rate this Post:
0
?
Echoes -jee,
So learnt that, with the Httprequest object, the following methods should be executed
.Open "POST",
.SetRequestHeader
.Send
For requestheader, i found a few examples like -
...
Example#1
' Grab the file
nFile = FreeFile
Open StrFileName For Binary As #nFile
strFile = String(LOF(nFile), " ")
Get #nFile, , strFile
Close #nFile
' Assemble an HTTP request.
WinHttpReq.Open "POST", strURL, False
' Set the header
WinHttpReq.SetRequestHeader "Content-Type", "multipart/form-data; boundary=Xu02=$"
' Assemble the body
strBody = "--Xu02=$" & vbCrLf & _
"Content-Disposition: form-data; name=files; filename=" & vbCrLf & _
"Content-type: file" & vbCrLf & vbCrLf & _
strFile & vbCrLf & _
"--Xu02=$--"
' Because of binary zeros, post body has to convert to byte array
aPostBody = StrConv(strBody, vbFromUnicode)
' Send the HTTP Request.
WinHttpReq.Send aPostBody
...Another one, simply
Example#2
/ Initialize an HTTP request.
WinHttpReq.Open("PUT", "http://postserver/newdoc.htm", false)
// Post data to the HTTP server.
WinHttpReq.Send("Post data")
For me, both would work because my file is a plain text file. However, I got stuck for,
1. With the former approach, it looks like it is reading the file into a byte array- i guess vbscript does not quite encurage that straightly. And I can't understand what the "boundary" in the request-header is.
2. With the second approach,
WinHttpReq.Send("Post data"), looks neat and hot. The contents of my file can be the "Post data" inside the brackets.
BUT,
How do I retrieve them in the server-side php? With regular POST or GET, there used to be variable-names to the data, right? Those $_POST[xxxx] kind of things?
I mean, how do I access the post data in the server-side for this cool object?
Any ideas please???
Thanks in advance