Ask a Question related to ASP Database, Design and Development.
-
Fox #1
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
-
What is the difference between REQUEST and REQUEST.QUERYSTRING?
What is the difference between these two statements? They seem to do the same thing... response.write(request("variable")) ... -
request querystring
Using the querystring collection in ASP, I'm declaring variables and setting each variable equal to querystring values: <% Dim x Dim y Dim z x =... -
Request.Form("Field Name") Versus Request.QueryString("Field Name")
I want to know what's the differences between Request.Form("Field Name") and Request.QueryString("Field Name") OR they function exactly the... -
best way to get data: request.form, request.params, controlname.value
Hi! I think I remember somewhere that using request.form was a bad idea (I can't say I remember why). So I'm wondering: What is the best way to... -
difference bet. request.querystring and Request.Params
request.params for asp.net is the httprequest object, and this method gets a combined collection of querystring, cookies, form and servervars... -
Ken Schaefer #2
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.1580@tk2msftngp13.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
-
Fox #3
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" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:e6Hb7FsbDHA.2544@TK2MSFTNGP09.phx.gbl...the> 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 inin> Request.QueryString() collection.
>
> That is one way, using a form, and POST, you can end up with information> both collections.
>
> Cheers
> Ken
>
>
> "Fox" <fox @ connexions .net> wrote in message
> news:%23H%23bIBrbDHA.1580@tk2msftngp13.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
-
Fox #4
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" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:e6Hb7FsbDHA.2544@TK2MSFTNGP09.phx.gbl...the> 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 inn> Request.QueryString() collection.
>
> That is one way, using a form, and POST, you can end up with information i> both collections.
>
> Cheers
> Ken
>
>
> "Fox" <fox @ connexions .net> wrote in message
> news:%23H%23bIBrbDHA.1580@tk2msftngp13.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
-
Ken Schaefer #5
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.1748@TK2MSFTNGP12.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" <kenREMOVE@THISadOpenStatic.com> wrote in message
: news:e6Hb7FsbDHA.2544@TK2MSFTNGP09.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.1580@tk2msftngp13.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



Reply With Quote

