473,569 Members | 2,664 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 2085
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
2525
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 started sending out the content of the page. Web content is always delivered with a few headers at the top, ending with a blank line. For...
1
3382
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 fine for about two months; the Debugger was getting control. Then, all of a sudden, it has stopped getting control. I checked the settings above and...
2
6901
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 a type mismatch. It is positively because of the boolean(java primitive)parameter. It goes fine if I change this parameter to int or String. This...
3
2712
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. When I try and set the property the compiler throws up Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member...
3
2270
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 window) ++num;
32
4981
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 not a function" ---------------------------------------------------- I have this in a .js file and in the head section.
1
3177
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 follows: The code below is for the first page:session_start is in line 3 <link href="css/jobSheet.css" rel="stylesheet" type="text/css" /> ...
1
2667
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" type="text/css" /> <script src="Dunbarlab9.js" type="text/javascript"></script> <script type="text/javascript">
1
1770
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. domain user name). actually once i run exe file the generated file name is according to user itself for eg if "xyz" is a domain user who logged...
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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 we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.