XML Help please
I am a newbie in asp and having difficulty to understand the different between these 2 codes. Could someone please help?
== Process.asp ==
<%
.
.
.some more code
Function SendTransaction()
'If Request.Form("CC_Number") <> "" Then
sXmlAction = sXmlAction & "<Txn><PostUsername>" & Request.Form("Access") & "</PostUsername>"
sXmlAction = sXmlAction & "<PostPassword>" & Request.Form("Entry") & "</PostPassword>"
sXmlAction = sXmlAction & "<TxnType>" & Request.Form("TxnType") & "</TxnType>"
sXmlAction = sXmlAction & "<CardHolderName>" & Request.Form("CC_Name") & "</CardHolderName>"
sXmlAction = sXmlAction & "<CardNumber>" & Request.Form("CC_Number") & "</CardNumber>"
sXmlAction = sXmlAction & "<Amount>" & Request.Form("TotalAmount") & "</Amount>"
sXmlAction = sXmlAction & "<DateExpiry>" & ExpiryDate & "</DateExpiry>"
sXmlAction = sXmlAction & "<MerchantReference>" & Request.Form("MerchantRef") & "</MerchantReference>"
sXmlAction = sXmlAction & "<ReceiptEmail>" & Str_To & "</ReceiptEmail></Txn>"
Dim objXMLhttp
Set objXMLhttp = server.Createobject("MSXML2.XMLHTTP")
objXMLhttp.Open "POST", "https://www.someurl/pxpost.aspx" ,True
objXMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXMLhttp.send sXmlAction
'response.write objXMLhttp.responsetext
Set objXMLhttp = nothing
'End If
End Function
' Send Credit Card Transaction
Call SendTransaction()
.
.
.some more code
%>
== pxpost.asp ==
<%
'If Request.Form("Username") <> "" Then
sXmlAction = sXmlAction & "<Txn><PostUsername>" & Request.Form("Username") & "</PostUsername>"
sXmlAction = sXmlAction & "<PostPassword>" & Request.Form("Password") & "</PostPassword>"
sXmlAction = sXmlAction & "<TxnType>" & Request.Form("TxnType") & "</TxnType>"
sXmlAction = sXmlAction & "<CardHolderName>" & Request.Form("CardHolderName") & "</CardHolderName>"
sXmlAction = sXmlAction & "<CardNumber>" & Request.Form("CardNumber") & "</CardNumber>"
sXmlAction = sXmlAction & "<Amount>" & Request.Form("AmountInput") & "</Amount>"
sXmlAction = sXmlAction & "<DateExpiry>" & Request.Form("ExpiryDate") & "</DateExpiry>"
sXmlAction = sXmlAction & "<MerchantReference>" & Request.Form("MerchantRef") & "</MerchantReference>"
sXmlAction = sXmlAction & "<ReceiptEmail>" & Request.form("Email") & "</ReceiptEmail></Txn>"
Dim objXMLhttp
Set objXMLhttp = server.Createobject("MSXML2.XMLHTTP")
objXMLhttp.Open "POST", "https://www.someurl.com/pxpost.aspx" ,True
objXMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXMLhttp.send sXmlAction
'response.write objXMLhttp.responsetext
Set objXMLhttp = nothing
'End If
%>
<html>
<head></head>
<body>
<form action="pxpostsample.asp" method="post">
Username<input name="Username" value="Username"><br>
Username<input name="Password" value="Password"><br>
TxnType<input name="TxnType" value="Purchase"><br>
CardHolderName<input name="CardHolderName" value="test"><br>
CardNumber<input name="CardNumber" value="4111111111111111"><br>
AmountInput<input name="AmountInput" value="1.00"><br>
ExpiryDate<input name="ExpiryDate" value="0102"><br>
MerchantRef<input name="MerchantRef" value="post test"><br>
Email<input name="Email" value="email">
<input type="submit">
</form>
</body>
</html>
======
The pxpost.asp works by itself but when I put it into different file after submit using the process.asp the code does not seem to work anymore. Could someone help please.
|