Solved

tryig to convert asp, to php

Posted on 2008-10-13
9
511 Views
Last Modified: 2009-11-01
Hello.
i was trying to convert asp code, to php i used asp2php but dones't convert some codes in the asp file,

<html>
<%Dim product,price,qty,total,name,address,postal 
 
product = Request.QueryString("product")
price   = Request.QueryString("price")
qty     = Request.QueryString("qty")
total   = Request.QueryString("price")
name    = Request.QueryString("name")
address = Request.QueryString("email")
postal  = Request.QueryString("phone")
 
Dim MyObj
Set MyObj          = Server.CreateObject("e24PaymentPipe.e24PaymentPipe.1") 
MyObj.Action       = "1"  
MyObj.Amt          = total
MyObj.Currency     = "414"
MyObj.Language     = "USA"
MyObj.ResponseURL  = "http://192.168.1.5/payment/response.asp" 
MyObj.ErrorURL     = "http://192.168.1.5/payment/error.asp" 
MyObj.TrackID      = request.QueryString("OrderId") 
MyObj.ResourcePath = "/etc/" 
MyObj.Alias	   = "demo" 
MyObj.Udf1         = Request.QueryString("product")
MyObj.Udf2         = "User Defined Field 2"
MyObj.Udf3         = "User Defined Field 3"
MyObj.Udf4         = "User Defined Field 4"
MyObj.Udf5         = "User Defined Field 5"
 
 
Dim TransVal, varPaymentID, varPaymentPage, varErrorMsg, varRawResponse
 
TransVal = MyObj.PerformInitTransaction  
varRawResponse = MyObj.RawResponse
varPaymentID   = MyObj.PaymentID
varPaymentPage = MyObj.PaymentPage
varErrorMsg    = MyObj.ErrorMsg
 
if TransVal <> 0 Then
   response.redirect("error.asp")
Else
	response.redirect (varPaymentPage & "?PaymentID=" & varPaymentID) End if %>
 
</html>

Open in new window

0
Comment
Question by:BaderALrushedi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 8

Expert Comment

by:nahime
ID: 22701941
Your code can be tranlated in php as the code attached but you have to implement the e24PaymentPipe_e24PaymentPipe_1 class that is called in the asp file.
<html>
<?php
 
$product = $_GET["product"];
$price   = $_GET["price"];
$qty     = $_GET["qty"];
$total   = $_GET["price"];
$name    = $_GET["name"];
$address = $_GET["email"];
$postal  = $_GET["phone"];
 
 
$MyObj = new e24PaymentPipe_e24PaymentPipe_1(); 
$MyObj->Action       = "1";
$MyObj->Amt          = "total";
$MyObj->Currency     = "414";
$MyObj->Language     = "USA";
$MyObj->ResponseURL  = "http://192.168.1.5/payment/response.asp";
$MyObj->ErrorURL     = "http://192.168.1.5/payment/error.asp";
$MyObj->TrackID      = $_GET["OrderId"];
$MyObj->ResourcePath = "/etc/";
$MyObj->Alias        = "demo"; 
$MyObj->Udf1         = $_GET["product"];
$MyObj->Udf2         = "User Defined Field 2";
$MyObj->Udf3         = "User Defined Field 3";
$MyObj->Udf4         = "User Defined Field 4";
$MyObj->Udf5         = "User Defined Field 5";
 
 
$TransVal = $MyObj->PerformInitTransaction();
$varRawResponse = $MyObj->RawResponse;
$varPaymentID   = $MyObj->PaymentID;
$varPaymentPage = $MyObj->PaymentPage;
$varErrorMsg    = $MyObj->ErrorMsg;
 
if (TransVal != 0) {
   header("Location: error.php");
}
else {
   header("Location: ".$varPaymentPage."?".$PaymentID".=".$varPaymentID);
}
 
?>
</html>

Open in new window

0
 

Author Comment

by:BaderALrushedi
ID: 22703568
thanks but its showing me an error with line 40
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /usr/local/www/apache22/data/payment/buy.php on line 40

Open in new window

0
 

Author Comment

by:BaderALrushedi
ID: 22703838
also please can you tell me what you mean with: implement the e24PaymentPipe_e24PaymentPipe_1 class
because we have it e24PaymentPipe.dll our system freebsd
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 8

Accepted Solution

by:
nahime earned 500 total points
ID: 22705802
Try to replace with the attached code.
I mean that your code call a asp class that maybe is in e24PaymentPipe.dll.
I think that the dll can't be integrated in php, if you have the source code of the dll you can convert also that in php.
<html>
<?php
 
$product = $_GET["product"];
$price   = $_GET["price"];
$qty     = $_GET["qty"];
$total   = $_GET["price"];
$name    = $_GET["name"];
$address = $_GET["email"];
$postal  = $_GET["phone"];
 
 
$MyObj = new e24PaymentPipe_e24PaymentPipe_1(); 
$MyObj->Action       = "1";
$MyObj->Amt          = "total";
$MyObj->Currency     = "414";
$MyObj->Language     = "USA";
$MyObj->ResponseURL  = "http://192.168.1.5/payment/response.asp";
$MyObj->ErrorURL     = "http://192.168.1.5/payment/error.asp";
$MyObj->TrackID      = $_GET["OrderId"];
$MyObj->ResourcePath = "/etc/";
$MyObj->Alias        = "demo"; 
$MyObj->Udf1         = $_GET["product"];
$MyObj->Udf2         = "User Defined Field 2";
$MyObj->Udf3         = "User Defined Field 3";
$MyObj->Udf4         = "User Defined Field 4";
$MyObj->Udf5         = "User Defined Field 5";
 
 
$TransVal = $MyObj->PerformInitTransaction();
$varRawResponse = $MyObj->RawResponse;
$varPaymentID   = $MyObj->PaymentID;
$varPaymentPage = $MyObj->PaymentPage;
$varErrorMsg    = $MyObj->ErrorMsg;
 
if ($TransVal != 0) { // There was an error here
   header("Location: error.php");
}
else {
   header("Location: ".$varPaymentPage."?".$PaymentID.".=".$varPaymentID); // Also here there was an error
}
 
?>
</html>

Open in new window

0
 

Author Comment

by:BaderALrushedi
ID: 22710557
its showing in error because that class of dll,
error msg: Fatal error: Class 'e24PaymentPipe_e24PaymentPipe_1' not found in /usr/local/www/apache22/data/payment/buy.php on line 13
0
 
LVL 8

Expert Comment

by:nahime
ID: 22710761
The class does not exists, you have to rewrite it or load the dll file in some way
0
 

Author Comment

by:BaderALrushedi
ID: 22710943
that dll made as the bank told us, for windows we have to regsvr32 e24PaymentPipe.dll in our system. and we are useing Freebsd. i tired to load the dll in the php.ini, but doesn't read the files also i install wine for running win software into our unix system and doesn't work also
0
 
LVL 8

Expert Comment

by:nahime
ID: 22714934
I don't know what kind of dll is, how it works and if it can be included in php script (I don't think is possible to read a dll from php on linux).
I suggest to you to verify with the bank if the dll can be used with php or if they have some other library to be used on unix systems.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question