Programmatically create HTTP post

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Re: Programmatically create HTTP post

    Thanks for the reply, Bob.

    Unfortunately this won't work for me. The external web site is expecting an
    HTTP POST document. My .asp server page processes the users' input, then
    needs to construct an HTTP POST document that simulates an HTML page with a
    <FORM> and four <INPUT> fields. My .asp page then needs to send this to the
    external site and the process the results.

    Here's what I would love to be able to do. HTTPDOMObject is a fictitious COM
    object:

    <%

    dim sUserInput
    dim oHTTPDocument <= fictitious object
    dim oXMLHTTP
    sUserInput = Request.Form("txtUserInput")

    set oHTTPDocument = Server.CreateObject("HTTPDOMObject.Document")
    oHTTPDocument.addTextField ("USERID", "MYUSERID")
    oHTTPDocument.AddTextField("PWD", "MYPASSWORD")
    oHTTPDocument.AddTextField("DETAILLEVEL", "FULL")
    oHTTPDocument.AddTextField("SEARCHAGRUMENT", cstr(sUserInput))
    oHTTPDocument.Method = "POST"
    set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    ....
    oXMLHTTP.Send(oHTTPDocument.FormData)


    I know how to employ the interfaces, I'm not quite sure how to construct the
    HTTP POST document.

    Does this clarify my problem, or perhaps I'm missing something.

    Thanks again,

    Mike

    "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    news:u38BFwsSDHA.2460@TK2MSFTNGP10.phx.gbl...
    > This is more of a client-side coding question. However, here is a demo
    I've
    > created that illustrates how to use the XMLHTTPRequest object:
    > [url]http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp[/url]
    > Scroll down to the Dynamic Listbox demo
    >
    > HTH,
    > Bob Barrows
    >
    > Mike Lopez wrote:
    > > Hello.
    > >
    > > From an .asp page, I need to "post" out to an external web site that
    > > will return a result as an XML document.
    > >
    > > In particular, when a user posts to my .asp page, I need to simulate
    > > a post of a page with four <input> fields, "call out" to the external
    > > web site, and then process the returned XML.
    > >
    > > I was looking at the MSXML 4.0 parser's object model, and there are
    > > send() methods of the IXMLHTTPRequest and
    > > IServerXMLHTTPRequest/ServerXMLHTTP interfaces, but I'm not sure how
    > > to "construct" the HTTP post data to send.
    > >
    > > Can anyone help?
    > >
    > > Thanks in advance,
    > >
    > > Mike
    >
    >

    Mike Lopez Guest

  2. Similar Questions and Discussions

    1. [HOW TO DO] Programmatically create photograms?
      LOT for you reply. Now I have the problem to refer to generated movieClip (how is it possible by name?) to move then and generate "trailer titles"...
    2. Programmatically create buttons from user control
      Hello guys, I have an application which is built upon several user controls. That is, I have a default template (default.aspx) that I load a user...
    3. DBI/ODBC question: how to create DB programmatically?
      Hi, I've been trying to figure out how to use ODBC with DBI. So far, I have created a DSN for an existing DB and managed to read tables, update...
    4. doing an http post
      For the benefit of others, I want to show how to do an HTTP POST request using fsockopen(). I banged my head against a wall for two days trying to...
    5. create treeview control programmatically
      see http://support.microsoft.com/default.aspx?scid=KB;EN-US;210125 "William Grigg" <wgrigg@draper.com> wrote in message...
  3. #2

    Default Re: Programmatically create HTTP post

    [url]www.aspfaq.com[/url]

    look for "Post" or "simulating a post request"

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider
    [email]mschupp@ielearning.com[/email]
    [url]http://www.ielearning.com[/url]
    714.637.9480 x17


    "Mike Lopez" <mikelpez@optonline.net> wrote in message
    news:eLYUvEtSDHA.1916@TK2MSFTNGP12.phx.gbl...
    > Thanks for the reply, Bob.
    >
    > Unfortunately this won't work for me. The external web site is expecting
    an
    > HTTP POST document. My .asp server page processes the users' input, then
    > needs to construct an HTTP POST document that simulates an HTML page with
    a
    > <FORM> and four <INPUT> fields. My .asp page then needs to send this to
    the
    > external site and the process the results.
    >
    > Here's what I would love to be able to do. HTTPDOMObject is a fictitious
    COM
    > object:
    >
    > <%
    >
    > dim sUserInput
    > dim oHTTPDocument <= fictitious object
    > dim oXMLHTTP
    > sUserInput = Request.Form("txtUserInput")
    >
    > set oHTTPDocument = Server.CreateObject("HTTPDOMObject.Document")
    > oHTTPDocument.addTextField ("USERID", "MYUSERID")
    > oHTTPDocument.AddTextField("PWD", "MYPASSWORD")
    > oHTTPDocument.AddTextField("DETAILLEVEL", "FULL")
    > oHTTPDocument.AddTextField("SEARCHAGRUMENT", cstr(sUserInput))
    > oHTTPDocument.Method = "POST"
    > set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    > ...
    > oXMLHTTP.Send(oHTTPDocument.FormData)
    >
    >
    > I know how to employ the interfaces, I'm not quite sure how to construct
    the
    > HTTP POST document.
    >
    > Does this clarify my problem, or perhaps I'm missing something.
    >
    > Thanks again,
    >
    > Mike
    >
    > "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    > news:u38BFwsSDHA.2460@TK2MSFTNGP10.phx.gbl...
    > > This is more of a client-side coding question. However, here is a demo
    > I've
    > > created that illustrates how to use the XMLHTTPRequest object:
    > > [url]http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp[/url]
    > > Scroll down to the Dynamic Listbox demo
    > >
    > > HTH,
    > > Bob Barrows
    > >
    > > Mike Lopez wrote:
    > > > Hello.
    > > >
    > > > From an .asp page, I need to "post" out to an external web site that
    > > > will return a result as an XML document.
    > > >
    > > > In particular, when a user posts to my .asp page, I need to simulate
    > > > a post of a page with four <input> fields, "call out" to the external
    > > > web site, and then process the returned XML.
    > > >
    > > > I was looking at the MSXML 4.0 parser's object model, and there are
    > > > send() methods of the IXMLHTTPRequest and
    > > > IServerXMLHTTPRequest/ServerXMLHTTP interfaces, but I'm not sure how
    > > > to "construct" the HTTP post data to send.
    > > >
    > > > Can anyone help?
    > > >
    > > > Thanks in advance,
    > > >
    > > > Mike
    > >
    > >
    >
    >

    Mark Schupp Guest

  4. #3

    Default Re: Programmatically create HTTP post

    Look in this article: for the code that includes the all-important:
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"


    "Mark Schupp" <mschupp@ielearning.com> wrote in message
    news:%23t5FkeuSDHA.1552@TK2MSFTNGP12.phx.gbl...
    > [url]www.aspfaq.com[/url]
    >
    > look for "Post" or "simulating a post request"
    >
    > --
    > Mark Schupp
    > --
    > Head of Development
    > Integrity eLearning
    > Online Learning Solutions Provider
    > [email]mschupp@ielearning.com[/email]
    > [url]http://www.ielearning.com[/url]
    > 714.637.9480 x17
    >
    >
    > "Mike Lopez" <mikelpez@optonline.net> wrote in message
    > news:eLYUvEtSDHA.1916@TK2MSFTNGP12.phx.gbl...
    > > Thanks for the reply, Bob.
    > >
    > > Unfortunately this won't work for me. The external web site is expecting
    > an
    > > HTTP POST document. My .asp server page processes the users' input, then
    > > needs to construct an HTTP POST document that simulates an HTML page
    with
    > a
    > > <FORM> and four <INPUT> fields. My .asp page then needs to send this to
    > the
    > > external site and the process the results.
    > >
    > > Here's what I would love to be able to do. HTTPDOMObject is a fictitious
    > COM
    > > object:
    > >
    > > <%
    > >
    > > dim sUserInput
    > > dim oHTTPDocument <= fictitious object
    > > dim oXMLHTTP
    > > sUserInput = Request.Form("txtUserInput")
    > >
    > > set oHTTPDocument = Server.CreateObject("HTTPDOMObject.Document")
    > > oHTTPDocument.addTextField ("USERID", "MYUSERID")
    > > oHTTPDocument.AddTextField("PWD", "MYPASSWORD")
    > > oHTTPDocument.AddTextField("DETAILLEVEL", "FULL")
    > > oHTTPDocument.AddTextField("SEARCHAGRUMENT", cstr(sUserInput))
    > > oHTTPDocument.Method = "POST"
    > > set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    > > ...
    > > oXMLHTTP.Send(oHTTPDocument.FormData)
    > >
    > >
    > > I know how to employ the interfaces, I'm not quite sure how to construct
    > the
    > > HTTP POST document.
    > >
    > > Does this clarify my problem, or perhaps I'm missing something.
    > >
    > > Thanks again,
    > >
    > > Mike
    > >
    > > "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    > > news:u38BFwsSDHA.2460@TK2MSFTNGP10.phx.gbl...
    > > > This is more of a client-side coding question. However, here is a demo
    > > I've
    > > > created that illustrates how to use the XMLHTTPRequest object:
    > > > [url]http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp[/url]
    > > > Scroll down to the Dynamic Listbox demo
    > > >
    > > > HTH,
    > > > Bob Barrows
    > > >
    > > > Mike Lopez wrote:
    > > > > Hello.
    > > > >
    > > > > From an .asp page, I need to "post" out to an external web site that
    > > > > will return a result as an XML document.
    > > > >
    > > > > In particular, when a user posts to my .asp page, I need to simulate
    > > > > a post of a page with four <input> fields, "call out" to the
    external
    > > > > web site, and then process the returned XML.
    > > > >
    > > > > I was looking at the MSXML 4.0 parser's object model, and there are
    > > > > send() methods of the IXMLHTTPRequest and
    > > > > IServerXMLHTTPRequest/ServerXMLHTTP interfaces, but I'm not sure how
    > > > > to "construct" the HTTP post data to send.
    > > > >
    > > > > Can anyone help?
    > > > >
    > > > > Thanks in advance,
    > > > >
    > > > > Mike
    > > >
    > > >
    > >
    > >
    >
    >

    Paul Baker Guest

  5. #4

    Default Re: Programmatically create HTTP post

    Look in this article:
    [url]http://www.aspfaq.com/show.asp?id=2173[/url]

    Look for the code that includes this line:
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

    Paul

    "Mark Schupp" <mschupp@ielearning.com> wrote in message
    news:%23t5FkeuSDHA.1552@TK2MSFTNGP12.phx.gbl...
    > [url]www.aspfaq.com[/url]
    >
    > look for "Post" or "simulating a post request"
    >
    > --
    > Mark Schupp
    > --
    > Head of Development
    > Integrity eLearning
    > Online Learning Solutions Provider
    > [email]mschupp@ielearning.com[/email]
    > [url]http://www.ielearning.com[/url]
    > 714.637.9480 x17
    >
    >
    > "Mike Lopez" <mikelpez@optonline.net> wrote in message
    > news:eLYUvEtSDHA.1916@TK2MSFTNGP12.phx.gbl...
    > > Thanks for the reply, Bob.
    > >
    > > Unfortunately this won't work for me. The external web site is expecting
    > an
    > > HTTP POST document. My .asp server page processes the users' input, then
    > > needs to construct an HTTP POST document that simulates an HTML page
    with
    > a
    > > <FORM> and four <INPUT> fields. My .asp page then needs to send this to
    > the
    > > external site and the process the results.
    > >
    > > Here's what I would love to be able to do. HTTPDOMObject is a fictitious
    > COM
    > > object:
    > >
    > > <%
    > >
    > > dim sUserInput
    > > dim oHTTPDocument <= fictitious object
    > > dim oXMLHTTP
    > > sUserInput = Request.Form("txtUserInput")
    > >
    > > set oHTTPDocument = Server.CreateObject("HTTPDOMObject.Document")
    > > oHTTPDocument.addTextField ("USERID", "MYUSERID")
    > > oHTTPDocument.AddTextField("PWD", "MYPASSWORD")
    > > oHTTPDocument.AddTextField("DETAILLEVEL", "FULL")
    > > oHTTPDocument.AddTextField("SEARCHAGRUMENT", cstr(sUserInput))
    > > oHTTPDocument.Method = "POST"
    > > set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    > > ...
    > > oXMLHTTP.Send(oHTTPDocument.FormData)
    > >
    > >
    > > I know how to employ the interfaces, I'm not quite sure how to construct
    > the
    > > HTTP POST document.
    > >
    > > Does this clarify my problem, or perhaps I'm missing something.
    > >
    > > Thanks again,
    > >
    > > Mike
    > >
    > > "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    > > news:u38BFwsSDHA.2460@TK2MSFTNGP10.phx.gbl...
    > > > This is more of a client-side coding question. However, here is a demo
    > > I've
    > > > created that illustrates how to use the XMLHTTPRequest object:
    > > > [url]http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp[/url]
    > > > Scroll down to the Dynamic Listbox demo
    > > >
    > > > HTH,
    > > > Bob Barrows
    > > >
    > > > Mike Lopez wrote:
    > > > > Hello.
    > > > >
    > > > > From an .asp page, I need to "post" out to an external web site that
    > > > > will return a result as an XML document.
    > > > >
    > > > > In particular, when a user posts to my .asp page, I need to simulate
    > > > > a post of a page with four <input> fields, "call out" to the
    external
    > > > > web site, and then process the returned XML.
    > > > >
    > > > > I was looking at the MSXML 4.0 parser's object model, and there are
    > > > > send() methods of the IXMLHTTPRequest and
    > > > > IServerXMLHTTPRequest/ServerXMLHTTP interfaces, but I'm not sure how
    > > > > to "construct" the HTTP post data to send.
    > > > >
    > > > > Can anyone help?
    > > > >
    > > > > Thanks in advance,
    > > > >
    > > > > Mike
    > > >
    > > >
    > >
    > >
    >
    >

    Paul Baker Guest

  6. #5

    Default Re: Programmatically create HTTP post

    You're the man, Mark. That's all I had to do.

    Thanks a million.

    Mike

    "Paul Baker" <ask> wrote in message
    news:%23I%23CyiuSDHA.1664@TK2MSFTNGP11.phx.gbl...
    > Look in this article: for the code that includes the all-important:
    > xmlhttp.setRequestHeader "Content-Type",
    "application/x-www-form-urlencoded"
    >
    >
    > "Mark Schupp" <mschupp@ielearning.com> wrote in message
    > news:%23t5FkeuSDHA.1552@TK2MSFTNGP12.phx.gbl...
    > > [url]www.aspfaq.com[/url]
    > >
    > > look for "Post" or "simulating a post request"
    > >
    > > --
    > > Mark Schupp
    > > --
    > > Head of Development
    > > Integrity eLearning
    > > Online Learning Solutions Provider
    > > [email]mschupp@ielearning.com[/email]
    > > [url]http://www.ielearning.com[/url]
    > > 714.637.9480 x17
    > >
    > >
    > > "Mike Lopez" <mikelpez@optonline.net> wrote in message
    > > news:eLYUvEtSDHA.1916@TK2MSFTNGP12.phx.gbl...
    > > > Thanks for the reply, Bob.
    > > >
    > > > Unfortunately this won't work for me. The external web site is
    expecting
    > > an
    > > > HTTP POST document. My .asp server page processes the users' input,
    then
    > > > needs to construct an HTTP POST document that simulates an HTML page
    > with
    > > a
    > > > <FORM> and four <INPUT> fields. My .asp page then needs to send this
    to
    > > the
    > > > external site and the process the results.
    > > >
    > > > Here's what I would love to be able to do. HTTPDOMObject is a
    fictitious
    > > COM
    > > > object:
    > > >
    > > > <%
    > > >
    > > > dim sUserInput
    > > > dim oHTTPDocument <= fictitious object
    > > > dim oXMLHTTP
    > > > sUserInput = Request.Form("txtUserInput")
    > > >
    > > > set oHTTPDocument = Server.CreateObject("HTTPDOMObject.Document")
    > > > oHTTPDocument.addTextField ("USERID", "MYUSERID")
    > > > oHTTPDocument.AddTextField("PWD", "MYPASSWORD")
    > > > oHTTPDocument.AddTextField("DETAILLEVEL", "FULL")
    > > > oHTTPDocument.AddTextField("SEARCHAGRUMENT", cstr(sUserInput))
    > > > oHTTPDocument.Method = "POST"
    > > > set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    > > > ...
    > > > oXMLHTTP.Send(oHTTPDocument.FormData)
    > > >
    > > >
    > > > I know how to employ the interfaces, I'm not quite sure how to
    construct
    > > the
    > > > HTTP POST document.
    > > >
    > > > Does this clarify my problem, or perhaps I'm missing something.
    > > >
    > > > Thanks again,
    > > >
    > > > Mike
    > > >
    > > > "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    > > > news:u38BFwsSDHA.2460@TK2MSFTNGP10.phx.gbl...
    > > > > This is more of a client-side coding question. However, here is a
    demo
    > > > I've
    > > > > created that illustrates how to use the XMLHTTPRequest object:
    > > > > [url]http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp[/url]
    > > > > Scroll down to the Dynamic Listbox demo
    > > > >
    > > > > HTH,
    > > > > Bob Barrows
    > > > >
    > > > > Mike Lopez wrote:
    > > > > > Hello.
    > > > > >
    > > > > > From an .asp page, I need to "post" out to an external web site
    that
    > > > > > will return a result as an XML document.
    > > > > >
    > > > > > In particular, when a user posts to my .asp page, I need to
    simulate
    > > > > > a post of a page with four <input> fields, "call out" to the
    > external
    > > > > > web site, and then process the returned XML.
    > > > > >
    > > > > > I was looking at the MSXML 4.0 parser's object model, and there
    are
    > > > > > send() methods of the IXMLHTTPRequest and
    > > > > > IServerXMLHTTPRequest/ServerXMLHTTP interfaces, but I'm not sure
    how
    > > > > > to "construct" the HTTP post data to send.
    > > > > >
    > > > > > Can anyone help?
    > > > > >
    > > > > > Thanks in advance,
    > > > > >
    > > > > > Mike
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Mike Lopez Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139