Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Msxml2.ServerXMLHTTP Not Sending POST data (help)

Status
Not open for further replies.

baden

Programmer
Feb 6, 2002
125
US
The line containing "objXmlHttp.send params2Send" (in the 2nd code snipit) should send the post data, right? No POST data is being sent (which is the problem) The test.asp has:

Code:
Response.write "<h2>QueryString</h2>"
For Each obj In Request.QueryString
  Response.write obj & ": " & Request.QueryString(obj) & "<br>"
Next

Response.write "<h2>Form</h2>"
For Each obj In Request.Form
  Response.write obj & ": " & Request.Form(obj) & "<br>"
Next

No Form data is returned. I can append parameters to the end of sendStr which will be returned by the QueryString loop.

Can someone explain why this isn't working and how to get it working please?

Thanks.


Code:
   Dim objXmlHttp
   Dim strHTML
   
   Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")

   params2Send = "param1=" & param1 & "&param2=" & param2 & "&param3=" & param3

   sendStr = "[URL unfurl="true"]http://myserver.com/test.asp"[/URL]

   objXmlHttp.open "POST", sendStr, False
   ' Send it on it's merry way.
   objXmlHttp.send params2Send 

   'wait for response
   Do While objXmlHttp.readyState <> 4
      objXmlHttp.waitForResponse(1000)
   Loop   
      
   ' Print out the request status:
   Response.Write "Status: " & objXmlHttp.status & " " & objXmlHttp.statusText & "<br />"
   responseText = objXmlHttp.responseText
 
Just before .send - missing:
Code:
objXmlHttp.SetRequestHeader "Content-type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top