Professional Web Applications Themes

Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING - ASP Database

This is snipit of code, supplied by PayPal with explanation about what has to be done to access their back end. I am confused because they first speak of reading a POST then tell to use Request.Form to get variables from them. But then they say to add on "&cmd=_notify-validate". Am I wrong or does that last code tell me we are talking about a Query String and not a FORM variable ? Then further down the code they tell to post back to them like this objHttp.open "POST", Can someone take a look at this code below and help ...

  1. #1

    Default Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING

    This is snipit of code, supplied by PayPal with explanation
    about what has to be done to access their back end.

    I am confused because they first speak of reading a POST
    then tell to use Request.Form to get variables from them.
    But then they say to add on "&cmd=_notify-validate".
    Am I wrong or does that last code tell me we are
    talking about a Query String and not a FORM variable ?
    Then further down the code they tell to post back
    to them like this objHttp.open "POST",

    Can someone take a look at this code below and help
    me to understand if I am to use a QUERY STRING
    or a FORM and help staighten me out so I can work
    with this ? DO I capture the FORM collection or do I
    capture the QUERY STRING variables ?
    I know how I just don't know which.
    I just don't understand how they can talk about a form
    and put it in the syntax of a query. But then I am very
    limited in my understanding, especially if this had
    something to do with MSXML.

    ' read post from PayPal system and add 'cmd'
    str = Request.Form & "&cmd=_notify-validate"

    ' post back to PayPal system to validate
    set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
    ' set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
    objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
    objHttp.Send str

    Thanks,
    Fox



    Fox Guest

  2. #2

    Default Re: Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING

    Maybe an example...

    If you do this:

    <form method="post" action="newPage.asp?foo=bar">
    <input type="text" name="txtTest">
    <input type="submit" value="Submit">
    </form>

    then the HTTP method will be a POST (not a GET). All the *input* HTML
    element's values will be accessible via the Request.Form() collection (as
    you correctly state).

    However, notice that the *method* includes information as well? (foo=bar)?
    That information is sent as part of the resource request, and ends up in the
    Request.QueryString() collection.

    That is one way, using a form, and POST, you can end up with information in
    both collections.

    Cheers
    Ken


    "Fox" <fox connexions .net> wrote in message
    news:%23H%23bIBrbDHA.1580tk2msftngp13.phx.gbl...
    : This is snipit of code, supplied by PayPal with explanation
    : about what has to be done to access their back end.
    :
    : I am confused because they first speak of reading a POST
    : then tell to use Request.Form to get variables from them.
    : But then they say to add on "&cmd=_notify-validate".
    : Am I wrong or does that last code tell me we are
    : talking about a Query String and not a FORM variable ?
    : Then further down the code they tell to post back
    : to them like this objHttp.open "POST",
    :
    : Can someone take a look at this code below and help
    : me to understand if I am to use a QUERY STRING
    : or a FORM and help staighten me out so I can work
    : with this ? DO I capture the FORM collection or do I
    : capture the QUERY STRING variables ?
    : I know how I just don't know which.
    : I just don't understand how they can talk about a form
    : and put it in the syntax of a query. But then I am very
    : limited in my understanding, especially if this had
    : something to do with MSXML.
    :
    : ' read post from PayPal system and add 'cmd'
    : str = Request.Form & "&cmd=_notify-validate"
    :
    : ' post back to PayPal system to validate
    : set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    : ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
    : ' set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
    : objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    : objHttp.setRequestHeader "Content-type",
    "application/x-www-form-urlencoded"
    : objHttp.Send str
    :
    : Thanks,
    : Fox
    :
    :
    :


    Ken Schaefer Guest

  3. #3

    Default Re: Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING

    Thanks for the thoughts.
    But this is still confusing me.

    objHttp.Send str

    It looks painfully obvious here that I would be sending a GET
    but the command is
    objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
    objHttp.Send str

    This makes me think that the
    str = Request.Form & "&cmd=_notify-validate"
    with the "&cmd=mybutt" should instead be
    name=cmd input=mybutt

    I hate PayPal. How can they put this stuff out as an example
    with no explanation and no way to ask them ?

    I am concerned about committing to this until I understand.
    It is obviously so simple. Aren't those the worst ?
    And there is no way I know of to test it out.

    Do you know how I can find out what version of MSXML I have ?
    I run Windows 2000 server with all SPs and standard critical updates.

    Thanks
    Fox



    "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    news:e6Hb7FsbDHA.2544TK2MSFTNGP09.phx.gbl...
    > Maybe an example...
    >
    > If you do this:
    >
    > <form method="post" action="newPage.asp?foo=bar">
    > <input type="text" name="txtTest">
    > <input type="submit" value="Submit">
    > </form>
    >
    > then the HTTP method will be a POST (not a GET). All the *input* HTML
    > element's values will be accessible via the Request.Form() collection (as
    > you correctly state).
    >
    > However, notice that the *method* includes information as well? (foo=bar)?
    > That information is sent as part of the resource request, and ends up in
    the
    > Request.QueryString() collection.
    >
    > That is one way, using a form, and POST, you can end up with information
    in
    > both collections.
    >
    > Cheers
    > Ken
    >
    >
    > "Fox" <fox connexions .net> wrote in message
    > news:%23H%23bIBrbDHA.1580tk2msftngp13.phx.gbl...
    > : This is snipit of code, supplied by PayPal with explanation
    > : about what has to be done to access their back end.
    > :
    > : I am confused because they first speak of reading a POST
    > : then tell to use Request.Form to get variables from them.
    > : But then they say to add on "&cmd=_notify-validate".
    > : Am I wrong or does that last code tell me we are
    > : talking about a Query String and not a FORM variable ?
    > : Then further down the code they tell to post back
    > : to them like this objHttp.open "POST",
    > :
    > : Can someone take a look at this code below and help
    > : me to understand if I am to use a QUERY STRING
    > : or a FORM and help staighten me out so I can work
    > : with this ? DO I capture the FORM collection or do I
    > : capture the QUERY STRING variables ?
    > : I know how I just don't know which.
    > : I just don't understand how they can talk about a form
    > : and put it in the syntax of a query. But then I am very
    > : limited in my understanding, especially if this had
    > : something to do with MSXML.
    > :
    > : ' read post from PayPal system and add 'cmd'
    > : str = Request.Form & "&cmd=_notify-validate"
    > :
    > : ' post back to PayPal system to validate
    > : set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    > : ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
    > : ' set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
    > : objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    > : objHttp.setRequestHeader "Content-type",
    > "application/x-www-form-urlencoded"
    > : objHttp.Send str
    > :
    > : Thanks,
    > : Fox
    > :
    > :
    > :
    >
    >

    Fox Guest

  4. #4

    Default Re: Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING

    I found this page. Seems this form vs. query thing is unique to XML.
    [url]http://www.aspalliance.com/aaron/XMLpost.aspx[/url]

    Here is an example they give for a different purpose.
    But it does show the POST command and a URL sent in a query format.
    I guess this answers it.

    Set srvXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
    URL = "https://www.website.com/app/postquerydata.asp"
    srvXmlHttp.open "POST", URL, false
    srvXmlHttp.send("?ALNumber=345674&UserId=myid&Pass word=mypass")
    result = srvXmlHttp.responseText
    response.write(" "&result&" ")
    Set srvXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
    URL = "https://www.website.com/app/postquerydata.asp"
    srvXmlHttp.open "POST", URL, false
    srvXmlHttp.send("?ALNumber=345674&UserId=myid&Pass word=mypass")
    result = srvXmlHttp.responseText
    response.write(" "&result&" ")

    Now the only thing I wonder is does XML look at REQUEST.FORM
    as a command and read the entire query from it or are they telling me
    to read the collection and add the new variable to the end of it ?
    They offer this
    ' read post from PayPal system and add 'cmd'
    str = Request.Form & "&cmd=_notify-validate"

    Geesh, almost there ! What do you think ?
    There must be somewhere to check this code usage ?

    (G)
    Fox


    "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    news:e6Hb7FsbDHA.2544TK2MSFTNGP09.phx.gbl...
    > Maybe an example...
    >
    > If you do this:
    >
    > <form method="post" action="newPage.asp?foo=bar">
    > <input type="text" name="txtTest">
    > <input type="submit" value="Submit">
    > </form>
    >
    > then the HTTP method will be a POST (not a GET). All the *input* HTML
    > element's values will be accessible via the Request.Form() collection (as
    > you correctly state).
    >
    > However, notice that the *method* includes information as well? (foo=bar)?
    > That information is sent as part of the resource request, and ends up in
    the
    > Request.QueryString() collection.
    >
    > That is one way, using a form, and POST, you can end up with information i
    n
    > both collections.
    >
    > Cheers
    > Ken
    >
    >
    > "Fox" <fox connexions .net> wrote in message
    > news:%23H%23bIBrbDHA.1580tk2msftngp13.phx.gbl...
    > : This is snipit of code, supplied by PayPal with explanation
    > : about what has to be done to access their back end.
    > :
    > : I am confused because they first speak of reading a POST
    > : then tell to use Request.Form to get variables from them.
    > : But then they say to add on "&cmd=_notify-validate".
    > : Am I wrong or does that last code tell me we are
    > : talking about a Query String and not a FORM variable ?
    > : Then further down the code they tell to post back
    > : to them like this objHttp.open "POST",
    > :
    > : Can someone take a look at this code below and help
    > : me to understand if I am to use a QUERY STRING
    > : or a FORM and help staighten me out so I can work
    > : with this ? DO I capture the FORM collection or do I
    > : capture the QUERY STRING variables ?
    > : I know how I just don't know which.
    > : I just don't understand how they can talk about a form
    > : and put it in the syntax of a query. But then I am very
    > : limited in my understanding, especially if this had
    > : something to do with MSXML.
    > :
    > : ' read post from PayPal system and add 'cmd'
    > : str = Request.Form & "&cmd=_notify-validate"
    > :
    > : ' post back to PayPal system to validate
    > : set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    > : ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
    > : ' set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
    > : objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    > : objHttp.setRequestHeader "Content-type",
    > "application/x-www-form-urlencoded"
    > : objHttp.Send str
    > :
    > : Thanks,
    > : Fox
    > :
    > :
    > :
    >
    >

    Fox Guest

  5. #5

    Default Re: Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING

    Hi,

    Sorry, rereading your post tells me I completely missed the point!

    You are correct in your assumption. When reading in the entire
    Request.Form() collection, you get a set of name/value pairs (I suppose
    that's how ASP represents the entire Request.Form() collection to you). I
    suppose you can then append information to this (again using name/value
    pairs), and when you use ServerXMLHTTP to send the data back, it formats it
    appropriately into HTTP headers.

    Here's a better demonstration that shows how it all works (watch for
    wrapping):

    <html>
    <head>
    <title>Test Page</title>
    </head>
    <body>

    <form method="post" action="<%=Request.ServerVariables("Script_Name")% >"
    name=form1>
    <input type="text" name="txt1"><br>
    <input type="text" name="txt2"><br>
    <input type="submit" name="submit" value="PressThisButton">
    </form>

    <%
    If UCase(Request.ServerVariables("HTTP_Method")) = "POST" then

    Response.Write("<p>" & Request.Form & "</p>")

    Response.Write( _
    "<p>" & _
    "<a href=""" & Request.ServerVariables("Script_Name") & """>Start
    Again</a>" & _
    "</p>")

    End if
    %>


    </body>
    <html>



    Cheers
    Ken


    "Fox" <fox connexions .net> wrote in message
    news:%23CYqdPsbDHA.1748TK2MSFTNGP12.phx.gbl...
    : Thanks for the thoughts.
    : But this is still confusing me.
    :
    : objHttp.Send str
    :
    : It looks painfully obvious here that I would be sending a GET
    : but the command is
    : objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    : objHttp.setRequestHeader "Content-type",
    "application/x-www-form-urlencoded"
    : objHttp.Send str
    :
    : This makes me think that the
    : str = Request.Form & "&cmd=_notify-validate"
    : with the "&cmd=mybutt" should instead be
    : name=cmd input=mybutt
    :
    : I hate PayPal. How can they put this stuff out as an example
    : with no explanation and no way to ask them ?
    :
    : I am concerned about committing to this until I understand.
    : It is obviously so simple. Aren't those the worst ?
    : And there is no way I know of to test it out.
    :
    : Do you know how I can find out what version of MSXML I have ?
    : I run Windows 2000 server with all SPs and standard critical updates.
    :
    : Thanks
    : Fox
    :
    :
    :
    : "Ken Schaefer" <kenREMOVETHISadOpenStatic.com> wrote in message
    : news:e6Hb7FsbDHA.2544TK2MSFTNGP09.phx.gbl...
    : > Maybe an example...
    : >
    : > If you do this:
    : >
    : > <form method="post" action="newPage.asp?foo=bar">
    : > <input type="text" name="txtTest">
    : > <input type="submit" value="Submit">
    : > </form>
    : >
    : > then the HTTP method will be a POST (not a GET). All the *input* HTML
    : > element's values will be accessible via the Request.Form() collection
    (as
    : > you correctly state).
    : >
    : > However, notice that the *method* includes information as well?
    (foo=bar)?
    : > That information is sent as part of the resource request, and ends up in
    : the
    : > Request.QueryString() collection.
    : >
    : > That is one way, using a form, and POST, you can end up with information
    : in
    : > both collections.
    : >
    : > Cheers
    : > Ken
    : >
    : >
    : > "Fox" <fox connexions .net> wrote in message
    : > news:%23H%23bIBrbDHA.1580tk2msftngp13.phx.gbl...
    : > : This is snipit of code, supplied by PayPal with explanation
    : > : about what has to be done to access their back end.
    : > :
    : > : I am confused because they first speak of reading a POST
    : > : then tell to use Request.Form to get variables from them.
    : > : But then they say to add on "&cmd=_notify-validate".
    : > : Am I wrong or does that last code tell me we are
    : > : talking about a Query String and not a FORM variable ?
    : > : Then further down the code they tell to post back
    : > : to them like this objHttp.open "POST",
    : > :
    : > : Can someone take a look at this code below and help
    : > : me to understand if I am to use a QUERY STRING
    : > : or a FORM and help staighten me out so I can work
    : > : with this ? DO I capture the FORM collection or do I
    : > : capture the QUERY STRING variables ?
    : > : I know how I just don't know which.
    : > : I just don't understand how they can talk about a form
    : > : and put it in the syntax of a query. But then I am very
    : > : limited in my understanding, especially if this had
    : > : something to do with MSXML.
    : > :
    : > : ' read post from PayPal system and add 'cmd'
    : > : str = Request.Form & "&cmd=_notify-validate"
    : > :
    : > : ' post back to PayPal system to validate
    : > : set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    : > : ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
    : > : ' set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
    : > : objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
    : > : objHttp.setRequestHeader "Content-type",
    : > "application/x-www-form-urlencoded"
    : > : objHttp.Send str
    : > :
    : > : Thanks,
    : > : Fox
    : > :
    : > :
    : > :
    : >
    : >
    :
    :


    Ken Schaefer Guest

Similar Threads

  1. Replies: 7
    Last Post: December 29th, 02:02 PM
  2. request querystring
    By -D- in forum Dreamweaver AppDev
    Replies: 1
    Last Post: February 24th, 09:58 PM
  3. Replies: 2
    Last Post: August 18th, 05:00 AM
  4. Replies: 1
    Last Post: July 29th, 05:27 AM
  5. Replies: 2
    Last Post: July 4th, 12:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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