Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2003, 07:34 PM
Registered User
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I send data via HTTPS/POST server-side?

I have this data server side in variables and I would like to send it from the server via HTTPS/POST to a DLL at authorize.net that accepts HTTPS/POST. One way to do this I know of is to put javascript in my bodytag that autosubmits the form (with hidden input tags) after zero seconds but is there a more elegant, pure server-side way to do this? Maybe a component someone has built? It seems logical for something like this to work. Unfortunately authorize.net's AIM will not accept GET. Needs to be sent via POST. Thanks for any help you all can give!

 
Old November 6th, 2003, 09:03 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need your ISP to install WinHttp (free download from Microsoft) object on your web server. Some ISPs won't install foreign objects though.

Hope it points you in the right direction.

Code example (actually being used with AuthorizeNet to validate credit card transactions: edited for this post):
<%
Set WinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5")

'+
' Post data using ADC method from AuthorizeNet.
' Build your PostData string here FILL IN YOUR USER INFO INSTEAD!
'-
PostData = "x_Version=3.0"
PostData = PostData & "&x_ADC_Delim_Data=TRUE"
PostData = PostData & "&x_ADC_Delim_Character=|"
PostData = PostData & "&x_ADC_URL=FALSE"
PostData = PostData & "&x_Card_Num=" & "CreditCardNumber"
PostData = PostData & "&x_Exp_Date=" & "CardExpMonth" & "/" & "CardExpYear"
PostData = PostData & "&x_Amount=" & "OrderTotal"
PostData = PostData & "&x_Cust_ID=" & "CLIENT"
PostData = PostData & "&x_Invoice_Num=" & "ORDER"
PostData = PostData & "&x_First_Name=" & "FirstName"
PostData = PostData & "&x_Last_Name=" & "LastName"
PostData = PostData & "&x_Address=" & "Address"
PostData = PostData & "&x_City=" & "City"
PostData = PostData & "&x_State=" & "State"
PostData = PostData & "&x_Zip=" & "Zip"
PostData = PostData & "&x_Country=" & "Country"

' Add more information here if needed

WinHttp.Open "POST", "https://secure.authorize.net/gateway/transact.dll?" & PostData

WinHttp.Send ' Send request using https
ResponseText = WinHttp.ResponseText ' assign to local variable
ResponseArray = Split(ResponseText,"|") ' split delimited data
Select Case ResponseArray(0)
Case "1"
     ' Authenticated
Case Else
     Response.Write("Problem! reason: " & ResponseArray(3))
End Select
%>

 
Old February 4th, 2004, 01:56 AM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello
I want to post data to authorize.net as well as to my other website
i have used winHttp 5.and the following code but it is not working,iam working on ASP.NET.So can any body tell me how to post this data to otherwebsite? and also if i am posting the data to my another website how can i retreive this data from that page?
I am in great need.
Reg's
Kalyan
Quote:
quote:Originally posted by U.N.C.L.E.
 You need your ISP to install WinHttp (free download from Microsoft) object on your web server. Some ISPs won't install foreign objects though.

Hope it points you in the right direction.

Code example (actually being used with AuthorizeNet to validate credit card transactions: edited for this post):
<%
Set WinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5")

'+
' Post data using ADC method from AuthorizeNet.
' Build your PostData string here FILL IN YOUR USER INFO INSTEAD!
'-
PostData = "x_Version=3.0"
PostData = PostData & "&x_ADC_Delim_Data=TRUE"
PostData = PostData & "&x_ADC_Delim_Character=|"
PostData = PostData & "&x_ADC_URL=FALSE"
PostData = PostData & "&x_Card_Num=" & "CreditCardNumber"
PostData = PostData & "&x_Exp_Date=" & "CardExpMonth" & "/" & "CardExpYear"
PostData = PostData & "&x_Amount=" & "OrderTotal"
PostData = PostData & "&x_Cust_ID=" & "CLIENT"
PostData = PostData & "&x_Invoice_Num=" & "ORDER"
PostData = PostData & "&x_First_Name=" & "FirstName"
PostData = PostData & "&x_Last_Name=" & "LastName"
PostData = PostData & "&x_Address=" & "Address"
PostData = PostData & "&x_City=" & "City"
PostData = PostData & "&x_State=" & "State"
PostData = PostData & "&x_Zip=" & "Zip"
PostData = PostData & "&x_Country=" & "Country"

' Add more information here if needed

WinHttp.Open "POST", "https://secure.authorize.net/gateway/transact.dll?" & PostData

WinHttp.Send ' Send request using https
ResponseText = WinHttp.ResponseText ' assign to local variable
ResponseArray = Split(ResponseText,"|") ' split delimited data
Select Case ResponseArray(0)
Case "1"
     ' Authenticated
Case Else
     Response.Write("Problem! reason: " & ResponseArray(3))
End Select
%>

 
Old February 8th, 2004, 02:24 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you replace the "placeholder" values with your values?

Example: replace "CLIENT" with your AuthorizeNet client name, etc.

Also, you must have WinHTTP installed on your web host server machine.

 
Old February 8th, 2004, 02:31 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry for two posts in a row... Misunderstood your problem!

Example post to your own page:

WinHttp.Open "POST", "http://www.yoururl.com/yourpage.asp?" & PostData

Yourpage.asp:

<%
Reponse.Write(Request.Querystring)
%>


 
Old July 14th, 2004, 03:01 PM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot UNCLE, that code really helped as I was doing the exact thing you mentioned (integration with Authorize.NET). I had to change a few things to get it to work in Visual Basic, but all minor. Thanks again.

 
Old July 21st, 2004, 01:00 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried to use the sample above but it seems to only send the data as a send. Is there a way to send it as a post?

 
Old July 21st, 2004, 08:36 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Opps it was late when I typed that last message. I ment to say I can only send the data as a GET. Is there anyway to send it as a POST

-Matt

 
Old July 22nd, 2004, 12:52 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The method to use is specified with the call to:

WinHttp.Open "POST", ...

WinHttp.Open "GET", ...

The example uses POST method even though the query string is visible...





Similar Threads
Thread Thread Starter Forum Replies Last Post
using perl send data via "post" to a php web page robprell Perl 1 May 14th, 2007 05:57 AM
How do I send Post data to a Html site savejonas ASP.NET 2.0 Basics 1 June 2nd, 2006 02:05 PM
how to send https request in classic asp johndoewn Classic ASP Professional 1 March 25th, 2006 12:37 AM
The server side script is not send to the browser jaideepc ASP.NET 1.0 and 1.1 Basics 3 February 28th, 2004 12:23 AM
Accessing Server Side Data on Client Side steve456 Classic ASP Professional 3 October 15th, 2003 02:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.