PDA

View Full Version : http message request display


elkodesign
09-07-2005, 02:00 PM
Hi all,

Is there a way to find out what a http message request looks like?

I've tried to work out rfc2616 but it would be far more easy to just spit out just the message on screen using, for instance, php, asp or coldfusion.

More specific, i'm trying to simulate a form post with file upload using xmlhttprequest.

Yours truly,

Elko.

nikkiH
09-07-2005, 04:17 PM
Does this help?
http://www.15seconds.com/issue/001003.htm

elkodesign
09-08-2005, 09:59 AM
Indeed, tnx a lot! :thumbsup:

For the sake of completeness, my result VBScript is added below.

Greetingzzz.
Elko

--------------------------------------------------------------------------------

Dim xmlhttp
Dim url, boundary, body, SomeXMLString
SomeXMLString = ".."

Function loadXMLDoc(mode)
url = "http://www.bladibla.com"
boundary = "-----averyimportantstupidstring"

body = ""
body = body & "--" & boundary & VBNewLine
body = body & "Content-Disposition: form-data; name=""xml""; "
body = body & "filename=""C:\temp.xml""" & VBNewLine
body = body & "Content-Type: text/xml" & VBNewLine & VBNewLine

body = body & SomeXMLString
body = body & "--" & boundary & "--"

Set xmlhttp=createObject("Microsoft.XMLHTTP")
xmlhttp.onreadystatechange=getRef("state_Change")
call xmlhttp.open("POST", url, true)
call xmlhttp.setRequestHeader("Content-Type", "multipart/form-data; boundary=" & boundary & "")
call xmlhttp.send(body)
End Function

Function state_Change()
If xmlhttp.readyState=4 Then
If xmlhttp.status=200 Then
alert("XML data OK")
document.getElementById("result_xml").innerText = xmlhttp.responsetext
Else
alert("Problem retrieving XML data:" & xmlhttp.statusText)
document.getElementById("result_xml").innerText = body
End If
End If
End Function