Using MSXML2.ServerXMLHTTP.4.0 to get a form value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dfordinal
    New Member
    • Nov 2008
    • 2

    Using MSXML2.ServerXMLHTTP.4.0 to get a form value

    I am calling a remote web server and awaiting data that is being passed back to my process in a form variable.

    postData = "fname=John "
    Set xmlHttp = Server.Createob ject("MSXML2.Se rverXMLHTTP.4.0 ")
    Call xmlHttp.Open("P OST", "http://www.webSite.com ", false)
    Call xmlHttp.setRequ estHeader("Cont ent-Type", "applicatio n/x-www-form-urlencoded")
    Call xmlHttp.send(po stData)
    Response.Conten tType = "text/html"

    'Need to get two values from a form.

    I am familiar with getting back the xmlHttp.respons etext to get back all of a webpage that is passed back but not how to get individual values from the form.
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    If you know the names of the form inputs, you just call them as request("inputN ame") or request.form("i nputName"). If you don't know the names, you can loop through them like this:
    Code:
    for each x in request.form
       'perform action on request(x)
    next
    Let me know if this helps.

    Jared

    Comment

    • dfordinal
      New Member
      • Nov 2008
      • 2

      #3
      I thought I would have to get the form data from the responsetext of the object.

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Originally posted by dfordinal
        I thought I would have to get the form data from the responsetext of the object.
        I guess that depends on whether you are using "classic" ASP or ASP.NET. In "classic" ASP all requests are in THE request object. If you are using ASP.NET, then you posted in the wrong forum - this forum is for classic ASP only - as the sticky at the top of this forum says.

        Jared

        Comment

        Working...