473,216 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

Getting a Script into PHP

Hi, I'm building an e-commerce website for a friend and am having a bit of trouble. I'm on the checkout part where I need to submit the information to the payment gateway. The gateway has no support for php. I have the script in VBScript and JavaScript, but have run into dead ends with both. Here is what the script needs to do:

1. Create the XML object.
2. Set the objects address to the api and the request header also
3. Send the data.
4. Have the Response Text Avaliable to stick on page

Here's the code in VBScript
Expand|Select|Wrap|Line Numbers
  2. 'create the XML object
  3. set objXML=createobject("MSXML2.XMLHTTP")
  5. 'set the XML object's address to the PayTrace API
  6. objXML.Open "POST", "https://paytrace.com/api/default.pay",  false
  7. objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  10. posteddata="parmList=un~demo123|pswd~demo123|method~processtranx|tranxtype~sale|terms~Y|test~Y|"
  11. posteddata=posteddata & "CC~4012881888818888|expmnth~12|expyr~03|amount~1.00|baddress~1234 Main#3|"
  13. 'send the request to the PayTrace API
  14. objXML.Send posteddata
  16. 'Catch the reponse from the PayTrace API
  17. str = objXML.ResponseText
  19. 'Clean up and destroy the XML object
  20. set objXML = nothing
Here it is in JavaScript
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3. function checkout() 
  5. {
  6.     if(window.XMLHttpRequest) {
  7.         xmlhttp = new XMLHttpRequest(); // Gecko (Firefox, Moz), KHTML (Konqueror, Safari), Opera
  8.     } else if(window.ActiveXObject) {
  9.         xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); // Internet Explorer
  10.     } else {
  11.         return false;
  12.     }
  16. xmlhttp.open("POST", "https://paytrace.com/api/default.pay", false);
  17. xmlhttp.setRequestHeader ("Content-Type" , "application/x-www-form-urlencoded");
  21. xmlhttp.send ("parmList=un~demo123|pswd~demo123|method~processtranx|tranxtype~sale|terms~Y|test~Y|CC~4012881888818888|expmnth~12|expyr~03|amount~1.00|baddress~1234 Main#3|"); 
  25. alert(xmlhttp.ResponseText);
  26. }
  29. //-->
  30. </script>
Due to Compatibility issues and security issues with browsers neither will work for what I want them to do. Thanks for any and all help,
Sep 2 '05 #1
1 2075
What does the other side expect to get. Is it a HTML file or a XML file.
If it is the latter why not sending it stait away instead of sending the html that makes XML on the, for you, client side.
Oct 6 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Philip Ronan | last post by:
OK, here's my 2p worth: === Q. Why am I getting the error message 'Headers already sent'? A. PHP produces this error message when you try to set a header for a web page after you have already...
by: John H. | last post by:
I installed the Microsoft Script Debugger and set the "Enable Script Debug" flag on in IIS. Also, I made sure that the "Disable Script Debug" flag was off in Internet Explorer. Everything ran...
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
by: Twanger | last post by:
I'm getting a compiler error on my ASP.NET page and I can't see the cause. I have a simple C# class compiled into a DLL and placed in my bin directory which has a public property QuestionText. ...
by: sundew | last post by:
so here is the test case: <head> <script type='text/javascript'> // this function simply returns the number of enumerable namespaces(objects) function numNSpaces(){ var num = 0; for(var i in...
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
by: ced69 | last post by:
having trouble getting marquee to work get object required errors tring t <title>This Month at the Chamberlain Civic Center</title> <link href="styles.css" rel="stylesheet"...
by: sbettadpur | last post by:
hello i am calling .exe file through my php script. i.e. using exec or system command, i am running exe file that exe file will create on txt file which contains who has logged into domain(i.e....
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.