473,503 Members | 6,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting a Script into PHP

2 New Member
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
  1.  
  2. 'create the XML object
  3. set objXML=createobject("MSXML2.XMLHTTP")
  4.  
  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"
  8.  
  9.  
  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|"
  12.  
  13. 'send the request to the PayTrace API
  14. objXML.Send posteddata
  15.  
  16. 'Catch the reponse from the PayTrace API
  17. str = objXML.ResponseText
  18.  
  19. 'Clean up and destroy the XML object
  20. set objXML = nothing
  21.  
Here it is in JavaScript
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3. function checkout() 
  4.  
  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.     }
  13.  
  14.  
  15.  
  16. xmlhttp.open("POST", "https://paytrace.com/api/default.pay", false);
  17. xmlhttp.setRequestHeader ("Content-Type" , "application/x-www-form-urlencoded");
  18.  
  19.  
  20.  
  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|"); 
  22.  
  23.  
  24.  
  25. alert(xmlhttp.ResponseText);
  26. }
  27.  
  28.  
  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,
Mikael
Sep 2 '05 #1
1 2081
bevort
53 New Member
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

5
2518
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...
1
3378
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...
2
6886
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...
3
2710
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. ...
3
2263
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...
32
4961
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...
1
3170
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...
1
2662
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"...
1
1765
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....
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.