Jump to content
Sign in to follow this  
DormGear.net

Could not execute curl help! please

Recommended Posts

Could someone please post the entire file? I am having trouble getting this to work and I'm not sure I'm editing the file correctly.

 

Thanks

Share this post


Link to post
Share on other sites

after getting the same error I made the changes suggested

CODE

if ($this->DEBUGGING == 1)

$result = shell_exec ("'$cpath' -k -v -s -S -E '$key' -m 90 -d '$xml' '$host'");

else

$result = shell_exec ("'$cpath' -k -s -S -E '$key' -m 90 -d '$xml' '$host'");

 

now I get a Page that printout everything that was being submitted to linkpoint

Share this post


Link to post
Share on other sites
after getting the same error I made the changes suggested

CODE

if ($this->DEBUGGING == 1)

$result = shell_exec ("'$cpath' -k -v -s -S -E '$key' -m 90 -d '$xml' '$host'");

else

$result = shell_exec ("'$cpath' -k -s -S -E '$key' -m 90 -d '$xml' '$host'");

 

now I get a Page that printout everything that was being submitted to linkpoint

this is probably because you have debugging on (value equals 1). try setting it to 0 in lpphp.php.

Share this post


Link to post
Share on other sites

my file is totally different from this one i dont see the word elsr or anyting can you help this is my code

 

<?php

# lpphp.php
# A php CLASS to communicate with
# LinkPoint: LINKPOINT LSGS API
# via the CURL module
# v2.0.007 20 jan 2003


class lpphp
{
var $crlf;
var $lpapi;
   
   function lpphp()
   {
       ### SET THE FOLLOWING FOUR FIELDS ###

       $this->EZ_CONVERSION = 1;       # 1 = HARDWIRE PORT TO 1129  default=1
       $this->DEBUGGING     = 0;       # diagnostic output          default=0=none
                                       #                                    1=ON
         
       #if php version > 4.0.2 use built-in php curl functions  (1=YES, 0=NO)
       $this->PHP_CURLFUNCS = 1;                                  # default=1=yes
                                                                  #         0=no
       
 #otherwise shell out to the curl binary
       #uncomment this next field ONLY if NOT using PHP_CURLFUNCS above (=0)
       #$this->curlpath = "/usr/bin/curl";                         # default=commented
 #$this->curlpath = "c:\\curl7.9\\curl.exe";
   }

### YOU SHOULD NOT EDIT THIS FILE BELOW THIS POINT ###

   //translate function for the "EASYFUNCS"
   function forward_trans($myfwdarray)
   {
       $ftranslate["gateway"]="invalid_a";
       $ftranslate["hostname"]="host";
       $ftranslate["port"]="port";
       $ftranslate["storename"]="configfile";
       $ftranslate["orderID"]="oid";
       $ftranslate["amount"]="chargetotal";
       $ftranslate["cardNumber"]="cardnumber";
       $ftranslate["cardExpMonth"]="expmonth";
       $ftranslate["cardExpYear"]="expyear";
       $ftranslate["name"]="bname";
       $ftranslate["address"]="baddr1";
       $ftranslate["city"]="bcity";
       $ftranslate["state"]="bstate";
       $ftranslate["zip"]="bzip";
       $ftranslate["country"]="bcountry";
       $ftranslate["trackingID"]="refrencenumber";
       $ftranslate["backOrdered"]="invalid_b";
       $ftranslate["keyfile"]="keyfile";

       reset($myfwdarray);

       while(list($key, $value) = each ($myfwdarray))
       {
           $checkthis=$ftranslate[$key];
           if(ereg("[A-Za-z0-9]+",$checkthis ))
           {
               unset($myfwdarray[$key]);
               $myrevarray[$checkthis]=$value;
           }
           else
           {
               $myrevarray["$key"]="$value";
           }
       }


       //make keyfile if none supplied
       $mykeyfile=$myrevarray["keyfile"];
       if(strlen($mykeyfile) < 1)
       {
           $mykeyfile=$myrevarray["configfile"];
           $mykeyfile.=".pem";
           $myrevarray["keyfile"]="$mykeyfile";
       }

       //make addr from baddr1 unless addr supplied
       $myavsaddr=$myrevarray["addr"];
       if(strlen($myavsaddr) < 1)
       {
           $myrevarray["addr"]=$myrevarray["baddr1"];
       }

       //fix up expyear
       $okexpyear=$myrevarray["expyear"];
       
       if($okexpyear > 1900)
           $okexpyear -=1900;
       
       if($okexpyear > 100)
           $okexpyear -=100;
       
       if(strlen($okexpyear) == 1)
           $okexpyear="0$okexpyear";

       $myrevarray["expyear"]=$okexpyear;

       //fix up expmonth
       $okexpmonth=$myrevarray["expmonth"];
       
       if(strlen($okexpmonth) == 1)
           $okexpymonth="0$okexpmonth";

       $myrevarray["expmonth"]=$okexpmonth;

       return $myrevarray;
   }


###########
# PROCESS #
###########    

   function process($pdata,$mycf)
   {
       $crlf=$this->crlf;
            
        // convert incoming hash to XML string
       $xml = $this->buildXML($pdata);

       if ($this->DEBUGGING == 1)
           echo "\noutgoing XML: \n" . $xml;

       // prepare the host/port string
       if ($this->EZ_CONVERSION == 1)
           $port = "1129";         #hard-wire to 1129
       else
           $port = $pdata["port"];

       $host = "https://".$pdata["host"].":".$port."/LSGSXML";

       // then setup key
       $key = $pdata["keyfile"];


       // if php version > 4.0.2 use built-in php curl functions.
       // otherwise shell out to curl

       if ($this->PHP_CURLFUNCS != 1) #call curl directly without built in PHP curl functions
       {
           if ($this->DEBUGGING == 1)
               echo "<BR>NOT using PHP curl methods<BR><BR>";

	 $cpath = $this->curlpath;
	 
           // Win32 command yikes!
 #	$result = exec ("$cpath -E \"$key\" -m 90 -d \"$xml\" $host", $retarr, $retnum);

           // *NIX command
           $result = exec ("'$cpath' -v -E '$key' -m 90 -d '$xml' '$host'", $retarr, $retnum);
       }


       else    # use PHP curl methods
       {  
#           if ($this->DEBUGGING == 1)
#               echo "<BR> Using PHP curl methods <BR>";

           // then encrypt and send the xml string
           $ch = curl_init ();
           curl_setopt ($ch, CURLOPT_URL,$host);
           curl_setopt ($ch, CURLOPT_POST, 1); 
           curl_setopt ($ch, CURLOPT_POSTFIELDS, $xml);
           curl_setopt ($ch, CURLOPT_SSLCERT, $key);
           curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
           $result = curl_exec ($ch);
 }

       if ($this->DEBUGGING == 1)
 {
	 echo "\n\nserver response: " . $result . "\n\n";
 }
 
 // then process the server response
       
       if (strlen($result) < 2)    # no response
       {
           $retarr["r_approved"]="ERROR";
           $retarr["r_error"]="Could not execute curl";
           return $retarr;
       }

 // put XML string into hash
       preg_match_all ("/<(.*?)>(.*?)\</", $result, $out, PREG_SET_ORDER);

       $n = 0;
       while (isset($out[$n]))
       {   
           $retarr[$out[$n][1]] = strip_tags($out[$n][0]);
           $n++; 
       }
               
       if ($this->DEBUGGING == 1)
       {	reset ($retarr);
           echo "At end of process(), returned hash:\n";
           while (list($key, $value) = each($retarr))
               echo "$key = $value\n"; 
	 echo "\n\n";
       }

       reset ($retarr);
       return $retarr;
   }


###############################
# CAPTURE_PAYMENT (pre-auth)  #
###############################

   function CapturePayment($mydata)
   {
       $mydata["chargetype"]="PREAUTH";

       $mynewdata=$this->forward_trans($mydata);
       $myretv=$this->process($mynewdata,"ALLSTDIN");
       
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $myrethash["statusCode"]=1;
           $myrethash["statusMessage"]=$myretv["r_error"];
           $myrethash["AVSCode"]=$myretv["r_code"];
           $myrethash["trackingID"]=$myretv["r_ref"];
           $myrethash["orderID"]=$myretv["r_ordernum"];
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }


#################
# RETURN_ORDER  #
#################

   function ReturnOrder($mydata)
   {
       $mydata["chargetype"]="CREDIT";
       
       $mynewdata=$this->forward_trans($mydata);
       $myretv=$this->process($mynewdata,"ALLSTDIN");
       
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $myrethash["statusCode"]=1;
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }


################
# RETURN_CARD  #
################

   function ReturnCard($mydata)
   {
       $mydata["chargetype"]="CREDIT";
       
       $mynewdata=$this->forward_trans($mydata);
       $myretv=$this->process($mynewdata,"ALLSTDIN");
       
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $myrethash["statusCode"]=1;
           $myrethash["statusMessage"]=$myretv["r_error"];
           $myrethash["trackingID"]=$myretv["r_ref"];
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }


###############
# BILL_ORDERS #
###############

   function BillOrders ($myarg)
   {
       $ret=0;
       $idx=0;
       $count=count($myarg["orders"]);

       while ($idx < $count)
       {
           $myarg["orders"][$idx]["invalid_a"] = $myarg["invalid_a"];
           $myarg["orders"][$idx]["host"] = $myarg["host"];
           $myarg["orders"][$idx]["port"] = $myarg["port"];
           $myarg["orders"][$idx]["configfile"] = $myarg["configfile"];
           $myarg["orders"][$idx]["keyfile"] = $myarg["keyfile"];
           $myarg["orders"][$idx]["Ip"] = $myarg["Ip"];
           $myarg["orders"][$idx]["result"] = $myarg["result"];

           $this->BillOrder(&$myarg["orders"][$idx]);

           if($myarg["orders"][$idx]["statusCode"] == 1)
           {
           $ret++;
           }
           $idx++;
       }

       return $ret;
   }


#########################
# BILL_ORDER (postauth) #
#########################

   function BillOrder($mydata)
   {
   //process the orders
       $mydata["chargetype"]="POSTAUTH";
 
 // no forwared trans ??!//
 
       $myretv=$this->process($mydata,"ALLSTDIN");

       // show the results
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $mydata["statusCode"]=1;
       }
       else
       {
           $mydata["statusCode"]=0;
           $mydata["statusMessage"]=$myretv["r_error"];
           print "Declined!<br>\n";
       }
   }


############################
# AUTHORIZE A SALE  (sale) #
############################

   function ApproveSale($mydata)
   {
       $mydata["chargetype"]="SALE"; 
       $mynewdata=$this->forward_trans($mydata);

       $myretv=$this->process($mynewdata,"ALLSTDIN");

       if(ereg("APPROVED", $myretv["r_approved"]))
       {
             $myrethash["statusCode"]=1;
             $myrethash["statusMessage"]=$myretv["r_error"];
             $myrethash["AVSCode"]=$myretv["r_code"];
             $myrethash["trackingID"]=$myretv["r_ref"];
             $myrethash["orderID"]=$myretv["r_ordernum"];
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }

######################
# CALCULATE SHIPPING #
######################

 function CalculateShipping($mydata)
   {
   $mydata["chargetype"]="CALCSHIPPING";

   $mynewdata=$this->forward_trans($mydata);
   $myretv=$this->process($mynewdata,"ALLSTDIN");


if (isset ($myretv["r_shipping"]))
{
 $myrethash["statusCode"]=1;
 $myrethash["statusMessage"]=$myretv["r_error"];
       $myrethash["shipping"]=$myretv["r_shipping"];
}
else
{
 $myrethash["statusCode"]=0;
 $myrethash["statusMessage"]=$myretv["r_error"];
}

return $myrethash;
   }


#################
# CALCULATE TAX #
#################

 function CalculateTax($mydata)
   {
   $mydata["chargetype"]="CALCTAX";

   $mynewdata=$this->forward_trans($mydata);
   $myretv=$this->process($mynewdata,"ALLSTDIN");

   
if (isset ($myretv["r_tax"]))
{
 $myrethash["statusCode"]=1;
 $myrethash["statusMessage"]=$myretv["r_error"];
       $myrethash["tax"]=$myretv["r_tax"];
}
else
{
 $myrethash["statusCode"]=0;
 $myrethash["statusMessage"]=$myretv["r_error"];
}

return $myrethash;
   }


###########################
# VOID A SALE  (Voidsale) #
###########################
   
function VoidSale($mydata)    {
   $mydata["chargetype"]="VOID";
   $mynewdata=$this->forward_trans($mydata);
$myretv=$this->process($mynewdata,"ALLSTDIN");
   
if(ereg("APPROVED", $myretv["r_approved"]))
   {   $myrethash["statusCode"]=1;
       $myrethash["statusMessage"]=$myretv["r_error"];
 $myrethash["AVSCode"]=$myretv["r_code"];
       $myrethash["trackingID"]=$myretv["r_ref"];
       $myrethash["orderID"]=$myretv["r_ordernum"];
   }
   else
   {
       $myrethash["statusCode"]=0;
       $myrethash["statusMessage"]=$myretv["r_error"];
   }
return $myrethash;
   
}

   ############################
   # Create a periodic bill   #
   ############################

function SetPeriodic ($mydata)
{
  	 $mydata["chargetype"]="SALE";

 $mynewdata=$this->forward_trans($mydata);
 $myretv=$this->process($mynewdata,"ALLSTDIN");
 
 if(ereg("APPROVED", $myretv["r_approved"]))
 {
	 $myrethash["statusCode"]=1;
	 $myrethash["statusMessage"]=$myretv["r_error"];
	 $myrethash["AVSCode"]=$myretv["r_code"];
	 $myrethash["trackingID"]=$myretv["r_ref"];
	 $myrethash["orderID"]=$myretv["r_ordernum"];
 }
 else
 {
	 $myrethash["statusCode"]=0;
	 $myrethash["statusMessage"]=$myretv["r_error"];
 }
 return $myrethash;

}

##################################
# Electronic check authorization #
##################################

function VirtualCheck ($mydata)
   {
 # this now does TELECHECK only
 
 $mydata["chargetype"]="sale";

 $mynewdata=$this->forward_trans($mydata);
 $myretv=$this->process($mynewdata,"ALLSTDIN");

 if(ereg("APPROVED", $myretv["r_approved"]))
 {
	 $myrethash["statusCode"]=1;
	 $myrethash["statusMessage"]=$myretv["r_error"];
	 $myrethash["trackingID"]=$myretv["r_ref"];
	 $myrethash["orderID"]=$myretv["r_ordernum"];
 }
 else
 {
	 $myrethash["statusCode"]=0;
	 $myrethash["statusMessage"]=$myretv["r_error"];
 }
 return $myrethash;
 
}


function VoidCheck ($mydata)
   {

 $mydata["chargetype"]="VOID";

 ##put in new field 12/27
 $mydata["voidcheck"]="1";

 $mynewdata=$this->forward_trans($mydata);
 $myretv=$this->process($mynewdata,"ALLSTDIN");

 if(ereg("APPROVED", $myretv["r_approved"]))// WE'LL SEE SOMETHING ELSE HERE
 {
	 $myrethash["statusCode"]=1;
	 $myrethash["statusMessage"]=$myretv["r_error"];
	 $myrethash["trackingID"]=$myretv["r_ref"];
	 $myrethash["orderID"]=$myretv["r_ordernum"];
 }
 else
 {
	 $myrethash["statusCode"]=0;
	 $myrethash["statusMessage"]=$myretv["r_error"];
 }
 return $myrethash;
 
}

###############################
#      b u i l d X M L        #
###############################

function buildXML($pdata)
{
       if ($this->DEBUGGING == 1)
 {
	 echo "\nat buildXML, incoming hash:\n";
	 while (list($key, $value) = each($pdata))
   echo "$key = $value \n";
 }

 $xml = "<order><orderoptions>";

 if (isset($pdata["chargetype"]))
	 $xml .= "<ordertype>" . $pdata["chargetype"] . "</ordertype>";

 if (isset($pdata["result"]))
	 $xml .= "<result>" . $pdata["result"] . "</result>";

 $xml .= "</orderoptions>";

 #__________________________________________

 $xml .= "<creditcard>";

 if (isset($pdata["cardnumber"]))
	 $xml .= "<cardnumber>" . $pdata["cardnumber"] . "</cardnumber>";

 if (isset($pdata["expmonth"]))
	 $xml .= "<cardexpmonth>" . $pdata["expmonth"] . "</cardexpmonth>";

 if (isset($pdata["expyear"]))
	 $xml .= "<cardexpyear>" . $pdata["expyear"] . "</cardexpyear>";

 if (isset($pdata["cvmvalue"]))
	 $xml .= "<cvmvalue>" . $pdata["cvmvalue"] . "</cvmvalue>";

 if (isset($pdata["cvmindicator"]))
 {
	 if (strtolower($pdata["cvmindicator"]) == "cvm_notprovided")
   $xml .= "<cvmindicator>not_provided</cvmindicator>";
   
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_not_present")
   $xml .= "<cvmindicator>not_present</cvmindicator>";	
           
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_provided")
   $xml .= "<cvmindicator>provided</cvmindicator>";
	 
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_illegible")
   $xml .= "<cvmindicator>illegible</cvmindicator>";
	 
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_no_imprint")
   $xml .= "<cvmindicator>no_imprint</cvmindicator>";
 }

 if (isset($pdata["track"]))
	 $xml .= "<track>" . $pdata["track"] . "</track>";

 $xml .= "</creditcard>";    
 
 #__________________________________________
    
 $xml .= "<merchantinfo>";
	 
 if (isset($pdata["configfile"]))
	 $xml .= "<configfile>" . $pdata["configfile"] . "</configfile>";

 if (isset($pdata["keyfile"]))
	 $xml .= "<keyfile>" . $pdata["keyfile"] . "</keyfile>";

 if (isset($pdata["host"]))
	 $xml .= "<host>" . $pdata["host"] . "</host>";

 if (isset($pdata["port"]))
	 $xml .= "<port>" . $pdata["port"] . "</port>";
 
 $xml .= "</merchantinfo>";
 
 #__________________________________________
 
 $xml .= "<payment>";
	 
 if (isset($pdata["chargetotal"]))
	 $xml .= "<chargetotal>" . $pdata["chargetotal"] . "</chargetotal>";
 
 if (isset($pdata["tax"]))
	 $xml .= "<tax>" . $pdata["tax"] . "</tax>";
 
 // if it's a tax calculation, put the taxtotal field into payment subtotal
 if (isset($pdata["taxtotal"]))
 {
	 if ($pdata["chargetype"] == "CALCTAX")
   $xml .= "<subtotal>" . $pdata["taxtotal"] . "</subtotal>";
	 else
   if (isset($pdata["subtotal"]))
  	 $xml .= "<subtotal>" . $pdata["subtotal"] . "</subtotal>";
 }
 else
	 if (isset($pdata["subtotal"]))
  	 $xml .= "<subtotal>" . $pdata["subtotal"] . "</subtotal>";


 if (isset($pdata["vattax"]))
	 $xml .= "<vattax>" . $pdata["vattax"] . "</vattax>";

 if (isset($pdata["shipping"]))
	 $xml .= "<shipping>" . $pdata["shipping"] . "</shipping>";

 $xml .= "</payment>";
 
 #__________________________________________

 $xml .= "<billing>";
 
 if (isset($pdata["name"]))
	 $xml .= "<name>" . $pdata["name"] . "</name>";
 elseif (isset($pdata["bname"]))
	 $xml .= "<name>" . $pdata["bname"] . "</name>";


 if (isset($pdata["bcompany"]))
	 $xml .= "<company>" . $pdata["bcompany"] . "</company>";


 if (isset($pdata["address"]))
	 $xml .= "<address1>" . $pdata["address"] . "</address1>";

 elseif (isset($pdata["baddr1"]))
	 $xml .= "<address1>" . $pdata["baddr1"] . "</address1>";

 elseif (isset($pdata["address1"]))
	 $xml .= "<address1>" . $pdata["address1"] . "</address1>";
 
 
 if (isset($pdata["address2"]))
	 $xml .= "<address2>" . $pdata["address2"] . "</address2>";
	 
 elseif (isset($pdata["baddr2"]))
	 $xml .= "<address2>" . $pdata["baddr2"] . "</address2>";
 
 
 if (isset($pdata["city"]))
	 $xml .= "<city>" . $pdata["city"] . "</city>";
	 
 elseif (isset($pdata["bcity"]))
	 $xml .= "<city>" . $pdata["bcity"] . "</city>";


 if (isset($pdata["state"]))
	 $xml .= "<state>" . $pdata["state"] . "</state>";
 elseif (isset($pdata["bstate"]))
	 $xml .= "<state>" . $pdata["bstate"] . "</state>";

	 
 if (isset($pdata["zip"]))
	 $xml .= "<zip>" . $pdata["zip"] . "</zip>";

 else if (isset($pdata["bzip"]))
	 $xml .= "<zip>" . $pdata["bzip"] . "</zip>";


 if (isset($pdata["country"]))
	 $xml .= "<country>" . $pdata["country"] . "</country>";

 else if (isset($pdata["bcountry"]))
	 $xml .= "<country>" . $pdata["bcountry"] . "</country>";
  
  
 if (isset($pdata["phone"]))
	 $xml .= "<phone>" . $pdata["phone"] . "</phone>";

 if (isset($pdata["fax"]))
	 $xml .= "<fax>" . $pdata["fax"] . "</fax>";

 if (isset($pdata["userid"]))
	 $xml .= "<userid>" . $pdata["userid"] . "</userid>";
	 
 if (isset($pdata["email"]))
	 $xml .= "<email>" . $pdata["email"] . "</email>";

 if (isset($pdata["addrnum"]))
	 $xml .= "<addrnum>" . $pdata["addrnum"] . "</addrnum>";

 $xml .= "</billing>";

 #__________________________________________

 $xml .= "<shipping>";

 if (isset($pdata["sname"]))
	 $xml .= "<name>" . $pdata["sname"] . "</name>";

 if (isset($pdata["saddr1"]))
	 $xml .= "<address1>" . $pdata["saddr1"] . "</address1>";

 if (isset($pdata["saddr2"]))
	 $xml .= "<address2>" . $pdata["saddr2"] . "</address2>";

 if (isset($pdata["scity"]))
	 $xml .= "<city>" . $pdata["scity"] . "</city>";
 
 if (isset($pdata["scountry"]))
	 $xml .= "<country>" . $pdata["scountry"] . "</country>";

 if (isset($pdata["shiptotal"]))
	 $xml .= "<total>" . $pdata["shiptotal"] . "</total>";
 
 if (isset($pdata["shipweight"]))
	 $xml .= "<weight>" . $pdata["shipweight"] . "</weight>";

 if (isset($pdata["shipcountry"]))
	 $xml .= "<country>" . $pdata["shipcountry"] . "</country>";
 
 if (isset($pdata["shipcarrier"]))
	 $xml .= "<carrier>" . $pdata["shipcarrier"] . "</carrier>";
 
 if (isset($pdata["shipitems"]))
	 $xml .= "<items>" . $pdata["shipitems"] . "</items>";
 

 if (isset($pdata["taxstate"]))
	 $xml .= "<state>" . $pdata["taxstate"] . "</state>";
 elseif (isset($pdata["shipstate"]))
	 $xml .= "<state>" . $pdata["shipstate"] . "</state>";
 elseif (isset($pdata["sstate"]))
	 $xml .= "<state>" . $pdata["sstate"] . "</state>";
 
 if (isset($pdata["taxzip"]))
	 $xml .= "<zip>" . $pdata["taxzip"] . "</zip>";
 elseif (isset($pdata["shipzip"]))
	 $xml .= "<zip>" . $pdata["shipzip"] . "</zip>";
 elseif (isset($pdata["szip"]))
	 $xml .= "<zip>" . $pdata["szip"] . "</zip>";
 elseif (isset($pdata["zip"]))
	 $xml .= "<zip>" . $pdata["zip"] . "</zip>";
       
 $xml .= "</shipping>";

 #__________________________________________
 # Check

 if (isset($pdata["routing"]))
 {
	 $xml .= "<telecheck>";
	 $xml .= "<routing>" . $pdata["routing"] . "</routing>";

	 if (isset($pdata["account"]))
   $xml .= "<account>" . $pdata["account"] . "</account>";

	 if (isset($pdata["bankname"]))
   $xml .= "<bankname>" . $pdata["bankname"] . "</bankname>";

	 if (isset($pdata["bankstate"]))
   $xml .= "<bankstate>" . $pdata["bankstate"] . "</bankstate>";

	 if (isset($pdata["checknumber"]))
   $xml .= "<checknumber>" . $pdata["checknumber"] . "</checknumber>";
   
	 if (isset($pdata["accounttype"]))
   $xml .= "<accounttype>" . $pdata["accounttype"] . "</accounttype>";

	 $xml .= "</telecheck>";
 }

 #void check 
 
 if (isset($pdata["voidcheck"]))
 {
	 $xml .= "<telecheck><void>1</void></telecheck>";
 }

 #__________________________________________
 # periodic
 
 if (isset($pdata["startdate"]))
 {
	 $xml .= "<periodic>";
	 
	 $xml .= "<startdate>" . $pdata["startdate"] . "</startdate>";

	 if (isset($pdata["installments"]))
   $xml .= "<installments>" . $pdata["installments"] . "</installments>";

	 if (isset($pdata["threshold"]))
     $xml .= "<threshold>" . $pdata["threshold"] . "</threshold>";
	 
	 if (isset($pdata["periodicity"]))
     $xml .= "<periodicity>" . $pdata["periodicity"] . "</periodicity>";
	 
	 if (isset($pdata["pbcomments"]))
     $xml .= "<comments>" . $pdata["pbcomments"] . "</comments>";
	 
	 if (isset($pdata["pbordertype"]))
	 {
   $xml .= "<action>";
    
   if ($pdata["pbordertype"] == "PbOrder_Submit") 
  	 $xml .= "submit";
   
   elseif($pdata["pbordertype"] == "PbOrder_Modify")
  	 $xml .= "modify";
   
   elseif($pdata["pbordertype"] == "PbOrder_Cancel")
  	 $xml .= "cancel";
   
   $xml .= "</action>";
	 }

	 $xml .= "</periodic>";
 }
 
 //___________________________________________

 $xml .= "<transactiondetails>";

 if (isset($pdata["transactionorigin"]))
	 $xml .= "<transactionorigin>" . $pdata["transactionorigin"] . "</transactionorigin>";
 
 if (isset($pdata["oid"]))
	 $xml .= "<oid>" . $pdata["oid"] . "</oid>";
 
 if (isset($pdata["reference_number"]))
	 $xml .= "<reference_number>" . $pdata["reference_number"] . "</reference_number>";
 
 if (isset($pdata["ponumber"]))
	 $xml .= "<ponumber>" . $pdata["ponumber"] . "</ponumber>";
       
 
 if (isset($pdata["recurring"]))
 {
	 if (strtoupper($pdata["recurring"]) == "RECURRING_TRANSACTION")
   $xml .= "<recurring>yes</recurring>";
	 elseif (strtoupper($pdata["recurring"]) == "NON_RECURRING_TRANSACTION")
   $xml .= "<recurring>no</recurring>";
 }
 
 if (isset($pdata["taxexempt"]))
   $xml .= "<taxexempt>" . $pdata["taxexempt"] . "</taxexempt>";
 elseif (isset($pdata["taxexmpt"]))
	 $xml .= "<taxexempt>" . $pdata["taxexmpt"] . "</taxexempt>";
	 
	 
 if (isset($pdata["terminaltype"]))
 {
	 if (strtoupper($pdata["terminaltype"]) == "TTYPE_UNSPECIFIED")
   $xml .= "<terminaltype>unspecified</terminaltype>";
	 elseif (strtoupper($pdata["terminaltype"]) == "TTYPE_STANDALONE")
   $xml .= "<terminaltype>standalone</terminaltype>";	
	 elseif (strtoupper($pdata["terminaltype"]) == "TTYPE_POS")
   $xml .= "<terminaltype>pos</terminaltype>";	
	 elseif (strtoupper($pdata["terminaltype"]) == "TTYPE_UNATTENDED")
   $xml .= "<terminaltype>unattended</terminaltype>";
       }
 
 if (isset($pdata["ip"]))
	 $xml .= "<ip>" . $pdata["ip"] . "</ip>";
 elseif (isset($pdata["Ip"]))
	 $xml .= "<ip>" . $pdata["Ip"] . "</ip>";
       
 if (isset($pdata["tdate"]))
	 $xml .= "<tdate>" . $pdata["tdate"] . "</tdate>";
 

 if (isset($pdata["mototransaction"]))
 {
	 if ($pdata["mototransaction"] == "MOTO_TRANSACTION")	
   $xml .= "<transactionorigin>moto</transactionorigin>";
	 
	 elseif ($pdata["mototransaction"] == "RETAIL_TRANSACTION")	
   $xml .= "<transactionorigin>retail</transactionorigin>";
	 
	 elseif ($pdata["mototransaction"] == "ECI_TRANSACTION")	
   $xml .= "<transactionorigin>eci</transactionorigin>";
 }
 
 if (isset($pdata["tdate"]))
	 $xml .= "<tdate>" . $pdata["tdate"] . "</tdate>";
 
 $xml .= "</transactiondetails>";


 if (isset($pdata["comments"]) || isset($pdata["referred"]))
 {
	 $xml .= "<notes>";
 
	 if (isset($pdata["comments"]))
   $xml .= "<comments>" . $pdata["comments"] . "</comments>";

	 if (isset($pdata["referred"]))
   $xml .= "<referred>" . $pdata["referred"] . "</referred>";

	 $xml .= "</notes>";
 }

 $xml .= "</order>";    

 return $xml;
}
}
?>

 

please tell me how to fic it thanks


Do what you do best!!

Share this post


Link to post
Share on other sites
my file is totally different from this one i dont see the word elsr or anyting can you help this is my code

I have the same file you have, and I can't seem to get it to work either! Can somebody please share their lpphp.php file or help us!

 

Thanks!

Share this post


Link to post
Share on other sites

I have the same v2.0.007 20 jan 2003 version of the lpphp.php file with no example of the code as shown in the prior example. Also after running a test credit card process I end up with a blank page here: checkout_process.php

Thanks

Share this post


Link to post
Share on other sites

if your using linkpoint credit card, make sure it is not in good mode which is test mode check it to live mode and replace your exisiting lpphp.php file with this one, but make sure you make a backup copy of the original one before replacing

<?php

# lpphp.php
# A php CLASS to communicate with
# LinkPoint: LINKPOINT LSGS API
# via the CURL module
# v2.0.007 20 jan 2003


class lpphp
{
var $crlf;
var $lpapi;
   
   function lpphp()
   {
       ### SET THE FOLLOWING FOUR FIELDS ###

       $this->EZ_CONVERSION = 1;       # 1 = HARDWIRE PORT TO 1129  default=1
       $this->DEBUGGING     = 0;       # diagnostic output          default=0=none
                                       #                                    1=ON
         
       #if php version > 4.0.2 use built-in php curl functions  (1=YES, 0=NO)
       $this->PHP_CURLFUNCS = 1;                                  # default=1=yes
                                                                  #         0=no
       
 #otherwise shell out to the curl binary
       #uncomment this next field ONLY if NOT using PHP_CURLFUNCS above (=0)
       #$this->curlpath = "/usr/bin/curl";                         # default=commented
 #$this->curlpath = "c:\\curl7.9\\curl.exe";
   }

### YOU SHOULD NOT EDIT THIS FILE BELOW THIS POINT ###

   //translate function for the "EASYFUNCS"
   function forward_trans($myfwdarray)
   {
       $ftranslate["gateway"]="invalid_a";
       $ftranslate["hostname"]="host";
       $ftranslate["port"]="port";
       $ftranslate["storename"]="configfile";
       $ftranslate["orderID"]="oid";
       $ftranslate["amount"]="chargetotal";
       $ftranslate["cardNumber"]="cardnumber";
       $ftranslate["cardExpMonth"]="expmonth";
       $ftranslate["cardExpYear"]="expyear";
       $ftranslate["name"]="bname";
       $ftranslate["address"]="baddr1";
       $ftranslate["city"]="bcity";
       $ftranslate["state"]="bstate";
       $ftranslate["zip"]="bzip";
       $ftranslate["country"]="bcountry";
       $ftranslate["trackingID"]="refrencenumber";
       $ftranslate["backOrdered"]="invalid_b";
       $ftranslate["keyfile"]="keyfile";

       reset($myfwdarray);

       while(list($key, $value) = each ($myfwdarray))
       {
           $checkthis=$ftranslate[$key];
           if(ereg("[A-Za-z0-9]+",$checkthis ))
           {
               unset($myfwdarray[$key]);
               $myrevarray[$checkthis]=$value;
           }
           else
           {
               $myrevarray["$key"]="$value";
           }
       }


       //make keyfile if none supplied
       $mykeyfile=$myrevarray["keyfile"];
       if(strlen($mykeyfile) < 1)
       {
           $mykeyfile=$myrevarray["configfile"];
           $mykeyfile.=".pem";
           $myrevarray["keyfile"]="$mykeyfile";
       }

       //make addr from baddr1 unless addr supplied
       $myavsaddr=$myrevarray["addr"];
       if(strlen($myavsaddr) < 1)
       {
           $myrevarray["addr"]=$myrevarray["baddr1"];
       }

       //fix up expyear
       $okexpyear=$myrevarray["expyear"];
       
       if($okexpyear > 1900)
           $okexpyear -=1900;
       
       if($okexpyear > 100)
           $okexpyear -=100;
       
       if(strlen($okexpyear) == 1)
           $okexpyear="0$okexpyear";

       $myrevarray["expyear"]=$okexpyear;

       //fix up expmonth
       $okexpmonth=$myrevarray["expmonth"];
       
       if(strlen($okexpmonth) == 1)
           $okexpymonth="0$okexpmonth";

       $myrevarray["expmonth"]=$okexpmonth;

       return $myrevarray;
   }


###########
# PROCESS #
###########    

   function process($pdata,$mycf)
   {
       $crlf=$this->crlf;
            
        // convert incoming hash to XML string
       $xml = $this->buildXML($pdata);

       if ($this->DEBUGGING == 1)
           echo "\noutgoing XML: \n" . $xml;

       // prepare the host/port string
       if ($this->EZ_CONVERSION == 1)
           $port = "1129";         #hard-wire to 1129
       else
           $port = $pdata["port"];

       $host = "https://".$pdata["host"].":".$port."/LSGSXML";

       // then setup key
       $key = $pdata["keyfile"];


       // if php version > 4.0.2 use built-in php curl functions.
       // otherwise shell out to curl

       if ($this->PHP_CURLFUNCS != 1) #call curl directly without built in PHP curl functions
       {
           if ($this->DEBUGGING == 1)
               echo "<BR>NOT using PHP curl methods<BR><BR>";

	 $cpath = $this->curlpath;
	 
           // Win32 command yikes!
 #	$result = exec ("$cpath -E \"$key\" -m 90 -d \"$xml\" $host", $retarr, $retnum);

           // *NIX command
           $result = exec ("'$cpath' -v -E '$key' -m 90 -d '$xml' '$host'", $retarr, $retnum);
       }


       else    # use PHP curl methods
       {  
#           if ($this->DEBUGGING == 1)
#               echo "<BR> Using PHP curl methods <BR>";

           // then encrypt and send the xml string
           $ch = curl_init ();
           curl_setopt ($ch, CURLOPT_URL,$host);
           curl_setopt ($ch, CURLOPT_POST, 1); 
           curl_setopt ($ch, CURLOPT_POSTFIELDS, $xml);
           curl_setopt ($ch, CURLOPT_SSLCERT, $key);
           curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
           curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); 
                       curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); 

           $result = curl_exec ($ch);
 }

       if ($this->DEBUGGING == 1)
 {
	 echo "\n\nserver response: " . $result . "\n\n";
 }
 
 // then process the server response
       
       if (strlen($result) < 2)    # no response
       {
           $retarr["r_approved"]="ERROR";
           $retarr["r_error"]="Could not execute curl";
           return $retarr;
       }

 // put XML string into hash
       preg_match_all ("/<(.*?)>(.*?)\</", $result, $out, PREG_SET_ORDER);

       $n = 0;
       while (isset($out[$n]))
       {   
           $retarr[$out[$n][1]] = strip_tags($out[$n][0]);
           $n++; 
       }
               
       if ($this->DEBUGGING == 1)
       {	reset ($retarr);
           echo "At end of process(), returned hash:\n";
           while (list($key, $value) = each($retarr))
               echo "$key = $value\n"; 
	 echo "\n\n";
       }

       reset ($retarr);
       return $retarr;
   }


###############################
# CAPTURE_PAYMENT (pre-auth)  #
###############################

   function CapturePayment($mydata)
   {
       $mydata["chargetype"]="PREAUTH";

       $mynewdata=$this->forward_trans($mydata);
       $myretv=$this->process($mynewdata,"ALLSTDIN");
       
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $myrethash["statusCode"]=1;
           $myrethash["statusMessage"]=$myretv["r_error"];
           $myrethash["AVSCode"]=$myretv["r_code"];
           $myrethash["trackingID"]=$myretv["r_ref"];
           $myrethash["orderID"]=$myretv["r_ordernum"];
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }


#################
# RETURN_ORDER  #
#################

   function ReturnOrder($mydata)
   {
       $mydata["chargetype"]="CREDIT";
       
       $mynewdata=$this->forward_trans($mydata);
       $myretv=$this->process($mynewdata,"ALLSTDIN");
       
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $myrethash["statusCode"]=1;
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }


################
# RETURN_CARD  #
################

   function ReturnCard($mydata)
   {
       $mydata["chargetype"]="CREDIT";
       
       $mynewdata=$this->forward_trans($mydata);
       $myretv=$this->process($mynewdata,"ALLSTDIN");
       
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $myrethash["statusCode"]=1;
           $myrethash["statusMessage"]=$myretv["r_error"];
           $myrethash["trackingID"]=$myretv["r_ref"];
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }


###############
# BILL_ORDERS #
###############

   function BillOrders ($myarg)
   {
       $ret=0;
       $idx=0;
       $count=count($myarg["orders"]);

       while ($idx < $count)
       {
           $myarg["orders"][$idx]["invalid_a"] = $myarg["invalid_a"];
           $myarg["orders"][$idx]["host"] = $myarg["host"];
           $myarg["orders"][$idx]["port"] = $myarg["port"];
           $myarg["orders"][$idx]["configfile"] = $myarg["configfile"];
           $myarg["orders"][$idx]["keyfile"] = $myarg["keyfile"];
           $myarg["orders"][$idx]["Ip"] = $myarg["Ip"];
           $myarg["orders"][$idx]["result"] = $myarg["result"];

           $this->BillOrder(&$myarg["orders"][$idx]);

           if($myarg["orders"][$idx]["statusCode"] == 1)
           {
           $ret++;
           }
           $idx++;
       }

       return $ret;
   }


#########################
# BILL_ORDER (postauth) #
#########################

   function BillOrder($mydata)
   {
   //process the orders
       $mydata["chargetype"]="POSTAUTH";
 
 // no forwared trans ??!//
 
       $myretv=$this->process($mydata,"ALLSTDIN");

       // show the results
       if(ereg("APPROVED", $myretv["r_approved"]))
       {
           $mydata["statusCode"]=1;
       }
       else
       {
           $mydata["statusCode"]=0;
           $mydata["statusMessage"]=$myretv["r_error"];
           print "Declined!<br>\n";
       }
   }


############################
# AUTHORIZE A SALE  (sale) #
############################

   function ApproveSale($mydata)
   {
       $mydata["chargetype"]="SALE"; 
       $mynewdata=$this->forward_trans($mydata);

       $myretv=$this->process($mynewdata,"ALLSTDIN");

       if(ereg("APPROVED", $myretv["r_approved"]))
       {
             $myrethash["statusCode"]=1;
             $myrethash["statusMessage"]=$myretv["r_error"];
             $myrethash["AVSCode"]=$myretv["r_code"];
             $myrethash["trackingID"]=$myretv["r_ref"];
             $myrethash["orderID"]=$myretv["r_ordernum"];
       }
       else
       {
           $myrethash["statusCode"]=0;
           $myrethash["statusMessage"]=$myretv["r_error"];
       }
       return $myrethash;
   }

######################
# CALCULATE SHIPPING #
######################

 function CalculateShipping($mydata)
   {
   $mydata["chargetype"]="CALCSHIPPING";

   $mynewdata=$this->forward_trans($mydata);
   $myretv=$this->process($mynewdata,"ALLSTDIN");


if (isset ($myretv["r_shipping"]))
{
 $myrethash["statusCode"]=1;
 $myrethash["statusMessage"]=$myretv["r_error"];
       $myrethash["shipping"]=$myretv["r_shipping"];
}
else
{
 $myrethash["statusCode"]=0;
 $myrethash["statusMessage"]=$myretv["r_error"];
}

return $myrethash;
   }


#################
# CALCULATE TAX #
#################

 function CalculateTax($mydata)
   {
   $mydata["chargetype"]="CALCTAX";

   $mynewdata=$this->forward_trans($mydata);
   $myretv=$this->process($mynewdata,"ALLSTDIN");

   
if (isset ($myretv["r_tax"]))
{
 $myrethash["statusCode"]=1;
 $myrethash["statusMessage"]=$myretv["r_error"];
       $myrethash["tax"]=$myretv["r_tax"];
}
else
{
 $myrethash["statusCode"]=0;
 $myrethash["statusMessage"]=$myretv["r_error"];
}

return $myrethash;
   }


###########################
# VOID A SALE  (Voidsale) #
###########################
   
function VoidSale($mydata)    {
   $mydata["chargetype"]="VOID";
   $mynewdata=$this->forward_trans($mydata);
$myretv=$this->process($mynewdata,"ALLSTDIN");
   
if(ereg("APPROVED", $myretv["r_approved"]))
   {   $myrethash["statusCode"]=1;
       $myrethash["statusMessage"]=$myretv["r_error"];
 $myrethash["AVSCode"]=$myretv["r_code"];
       $myrethash["trackingID"]=$myretv["r_ref"];
       $myrethash["orderID"]=$myretv["r_ordernum"];
   }
   else
   {
       $myrethash["statusCode"]=0;
       $myrethash["statusMessage"]=$myretv["r_error"];
   }
return $myrethash;
   
}

   ############################
   # Create a periodic bill   #
   ############################

function SetPeriodic ($mydata)
{
  	 $mydata["chargetype"]="SALE";

 $mynewdata=$this->forward_trans($mydata);
 $myretv=$this->process($mynewdata,"ALLSTDIN");
 
 if(ereg("APPROVED", $myretv["r_approved"]))
 {
	 $myrethash["statusCode"]=1;
	 $myrethash["statusMessage"]=$myretv["r_error"];
	 $myrethash["AVSCode"]=$myretv["r_code"];
	 $myrethash["trackingID"]=$myretv["r_ref"];
	 $myrethash["orderID"]=$myretv["r_ordernum"];
 }
 else
 {
	 $myrethash["statusCode"]=0;
	 $myrethash["statusMessage"]=$myretv["r_error"];
 }
 return $myrethash;

}

##################################
# Electronic check authorization #
##################################

function VirtualCheck ($mydata)
   {
 # this now does TELECHECK only
 
 $mydata["chargetype"]="sale";

 $mynewdata=$this->forward_trans($mydata);
 $myretv=$this->process($mynewdata,"ALLSTDIN");

 if(ereg("APPROVED", $myretv["r_approved"]))
 {
	 $myrethash["statusCode"]=1;
	 $myrethash["statusMessage"]=$myretv["r_error"];
	 $myrethash["trackingID"]=$myretv["r_ref"];
	 $myrethash["orderID"]=$myretv["r_ordernum"];
 }
 else
 {
	 $myrethash["statusCode"]=0;
	 $myrethash["statusMessage"]=$myretv["r_error"];
 }
 return $myrethash;
 
}


function VoidCheck ($mydata)
   {

 $mydata["chargetype"]="VOID";

 ##put in new field 12/27
 $mydata["voidcheck"]="1";

 $mynewdata=$this->forward_trans($mydata);
 $myretv=$this->process($mynewdata,"ALLSTDIN");

 if(ereg("APPROVED", $myretv["r_approved"]))// WE'LL SEE SOMETHING ELSE HERE
 {
	 $myrethash["statusCode"]=1;
	 $myrethash["statusMessage"]=$myretv["r_error"];
	 $myrethash["trackingID"]=$myretv["r_ref"];
	 $myrethash["orderID"]=$myretv["r_ordernum"];
 }
 else
 {
	 $myrethash["statusCode"]=0;
	 $myrethash["statusMessage"]=$myretv["r_error"];
 }
 return $myrethash;
 
}

###############################
#      b u i l d X M L        #
###############################

function buildXML($pdata)
{
       if ($this->DEBUGGING == 1)
 {
	 echo "\nat buildXML, incoming hash:\n";
	 while (list($key, $value) = each($pdata))
   echo "$key = $value \n";
 }

 $xml = "<order><orderoptions>";

 if (isset($pdata["chargetype"]))
	 $xml .= "<ordertype>" . $pdata["chargetype"] . "</ordertype>";

 if (isset($pdata["result"]))
	 $xml .= "<result>" . $pdata["result"] . "</result>";

 $xml .= "</orderoptions>";

 #__________________________________________

 $xml .= "<creditcard>";

 if (isset($pdata["cardnumber"]))
	 $xml .= "<cardnumber>" . $pdata["cardnumber"] . "</cardnumber>";

 if (isset($pdata["expmonth"]))
	 $xml .= "<cardexpmonth>" . $pdata["expmonth"] . "</cardexpmonth>";

 if (isset($pdata["expyear"]))
	 $xml .= "<cardexpyear>" . $pdata["expyear"] . "</cardexpyear>";

 if (isset($pdata["cvmvalue"]))
	 $xml .= "<cvmvalue>" . $pdata["cvmvalue"] . "</cvmvalue>";

 if (isset($pdata["cvmindicator"]))
 {
	 if (strtolower($pdata["cvmindicator"]) == "cvm_notprovided")
   $xml .= "<cvmindicator>not_provided</cvmindicator>";
   
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_not_present")
   $xml .= "<cvmindicator>not_present</cvmindicator>";	
           
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_provided")
   $xml .= "<cvmindicator>provided</cvmindicator>";
	 
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_illegible")
   $xml .= "<cvmindicator>illegible</cvmindicator>";
	 
	 elseif (strtolower($pdata["cvmindicator"]) == "cvm_no_imprint")
   $xml .= "<cvmindicator>no_imprint</cvmindicator>";
 }

 if (isset($pdata["track"]))
	 $xml .= "<track>" . $pdata["track"] . "</track>";

 $xml .= "</creditcard>";    
 
 #__________________________________________
    
 $xml .= "<merchantinfo>";
	 
 if (isset($pdata["configfile"]))
	 $xml .= "<configfile>" . $pdata["configfile"] . "</configfile>";

 if (isset($pdata["keyfile"]))
	 $xml .= "<keyfile>" . $pdata["keyfile"] . "</keyfile>";

 if (isset($pdata["host"]))
	 $xml .= "<host>" . $pdata["host"] . "</host>";

 if (isset($pdata["port"]))
	 $xml .= "<port>" . $pdata["port"] . "</port>";
 
 $xml .= "</merchantinfo>";
 
 #__________________________________________
 
 $xml .= "<payment>";
	 
 if (isset($pdata["chargetotal"]))
	 $xml .= "<chargetotal>" . $pdata["chargetotal"] . "</chargetotal>";
 
 if (isset($pdata["tax"]))
	 $xml .= "<tax>" . $pdata["tax"] . "</tax>";
 
 // if it's a tax calculation, put the taxtotal field into payment subtotal
 if (isset($pdata["taxtotal"]))
 {
	 if ($pdata["chargetype"] == "CALCTAX")
   $xml .= "<subtotal>" . $pdata["taxtotal"] . "</subtotal>";
	 else
   if (isset($pdata["subtotal"]))
  	 $xml .= "<subtotal>" . $pdata["subtotal"] . "</subtotal>";
 }
 else
	 if (isset($pdata["subtotal"]))
  	 $xml .= "<subtotal>" . $pdata["subtotal"] . "</subtotal>";


 if (isset($pdata["vattax"]))
	 $xml .= "<vattax>" . $pdata["vattax"] . "</vattax>";

 if (isset($pdata["shipping"]))
	 $xml .= "<shipping>" . $pdata["shipping"] . "</shipping>";

 $xml .= "</payment>";
 
 #__________________________________________

 $xml .= "<billing>";
 
 if (isset($pdata["name"]))
	 $xml .= "<name>" . $pdata["name"] . "</name>";
 elseif (isset($pdata["bname"]))
	 $xml .= "<name>" . $pdata["bname"] . "</name>";


 if (isset($pdata["bcompany"]))
	 $xml .= "<company>" . $pdata["bcompany"] . "</company>";


 if (isset($pdata["address"]))
	 $xml .= "<address1>" . $pdata["address"] . "</address1>";

 elseif (isset($pdata["baddr1"]))
	 $xml .= "<address1>" . $pdata["baddr1"] . "</address1>";

 elseif (isset($pdata["address1"]))
	 $xml .= "<address1>" . $pdata["address1"] . "</address1>";
 
 
 if (isset($pdata["address2"]))
	 $xml .= "<address2>" . $pdata["address2"] . "</address2>";
	 
 elseif (isset($pdata["baddr2"]))
	 $xml .= "<address2>" . $pdata["baddr2"] . "</address2>";
 
 
 if (isset($pdata["city"]))
	 $xml .= "<city>" . $pdata["city"] . "</city>";
	 
 elseif (isset($pdata["bcity"]))
	 $xml .= "<city>" . $pdata["bcity"] . "</city>";


 if (isset($pdata["state"]))
	 $xml .= "<state>" . $pdata["state"] . "</state>";
 elseif (isset($pdata["bstate"]))
	 $xml .= "<state>" . $pdata["bstate"] . "</state>";

	 
 if (isset($pdata["zip"]))
	 $xml .= "<zip>" . $pdata["zip"] . "</zip>";

 else if (isset($pdata["bzip"]))
	 $xml .= "<zip>" . $pdata["bzip"] . "</zip>";


 if (isset($pdata["country"]))
	 $xml .= "<country>" . $pdata["country"] . "</country>";

 else if (isset($pdata["bcountry"]))
	 $xml .= "<country>" . $pdata["bcountry"] . "</country>";
  
  
 if (isset($pdata["phone"]))
	 $xml .= "<phone>" . $pdata["phone"] . "</phone>";

 if (isset($pdata["fax"]))
	 $xml .= "<fax>" . $pdata["fax"] . "</fax>";

 if (isset($pdata["userid"]))
	 $xml .= "<userid>" . $pdata["userid"] . "</userid>";
	 
 if (isset($pdata["email"]))
	 $xml .= "<email>" . $pdata["email"] . "</email>";

 if (isset($pdata["addrnum"]))
	 $xml .= "<addrnum>" . $pdata["addrnum"] . "</addrnum>";

 $xml .= "</billing>";

 #__________________________________________

 $xml .= "<shipping>";

 if (isset($pdata["sname"]))
	 $xml .= "<name>" . $pdata["sname"] . "</name>";

 if (isset($pdata["saddr1"]))
	 $xml .= "<address1>" . $pdata["saddr1"] . "</address1>";

 if (isset($pdata["saddr2"]))
	 $xml .= "<address2>" . $pdata["saddr2"] . "</address2>";

 if (isset($pdata["scity"]))
	 $xml .= "<city>" . $pdata["scity"] . "</city>";
 
 if (isset($pdata["scountry"]))
	 $xml .= "<country>" . $pdata["scountry"] . "</country>";

 if (isset($pdata["shiptotal"]))
	 $xml .= "<total>" . $pdata["shiptotal"] . "</total>";
 
 if (isset($pdata["shipweight"]))
	 $xml .= "<weight>" . $pdata["shipweight"] . "</weight>";

 if (isset($pdata["shipcountry"]))
	 $xml .= "<country>" . $pdata["shipcountry"] . "</country>";
 
 if (isset($pdata["shipcarrier"]))
	 $xml .= "<carrier>" . $pdata["shipcarrier"] . "</carrier>";
 
 if (isset($pdata["shipitems"]))
	 $xml .= "<items>" . $pdata["shipitems"] . "</items>";
 

 if (isset($pdata["taxstate"]))
	 $xml .= "<state>" . $pdata["taxstate"] . "</state>";
 elseif (isset($pdata["shipstate"]))
	 $xml .= "<state>" . $pdata["shipstate"] . "</state>";
 elseif (isset($pdata["sstate"]))
	 $xml .= "<state>" . $pdata["sstate"] . "</state>";
 
 if (isset($pdata["taxzip"]))
	 $xml .= "<zip>" . $pdata["taxzip"] . "</zip>";
 elseif (isset($pdata["shipzip"]))
	 $xml .= "<zip>" . $pdata["shipzip"] . "</zip>";
 elseif (isset($pdata["szip"]))
	 $xml .= "<zip>" . $pdata["szip"] . "</zip>";
 elseif (isset($pdata["zip"]))
	 $xml .= "<zip>" . $pdata["zip"] . "</zip>";
       
 $xml .= "</shipping>";

 #__________________________________________
 # Check

 if (isset($pdata["routing"]))
 {
	 $xml .= "<telecheck>";
	 $xml .= "<routing>" . $pdata["routing"] . "</routing>";

	 if (isset($pdata["account"]))
   $xml .= "<account>" . $pdata["account"] . "</account>";

	 if (isset($pdata["bankname"]))
   $xml .= "<bankname>" . $pdata["bankname"] . "</bankname>";

	 if (isset($pdata["bankstate"]))
   $xml .= "<bankstate>" . $pdata["bankstate"] . "</bankstate>";

	 if (isset($pdata["checknumber"]))
   $xml .= "<checknumber>" . $pdata["checknumber"] . "</checknumber>";
   
	 if (isset($pdata["accounttype"]))
   $xml .= "<accounttype>" . $pdata["accounttype"] . "</accounttype>";

	 $xml .= "</telecheck>";
 }

 #void check 
 
 if (isset($pdata["voidcheck"]))
 {
	 $xml .= "<telecheck><void>1</void></telecheck>";
 }

 #__________________________________________
 # periodic
 
 if (isset($pdata["startdate"]))
 {
	 $xml .= "<periodic>";
	 
	 $xml .= "<startdate>" . $pdata["startdate"] . "</startdate>";

	 if (isset($pdata["installments"]))
   $xml .= "<installments>" . $pdata["installments"] . "</installments>";

	 if (isset($pdata["threshold"]))
     $xml .= "<threshold>" . $pdata["threshold"] . "</threshold>";
	 
	 if (isset($pdata["periodicity"]))
     $xml .= "<periodicity>" . $pdata["periodicity"] . "</periodicity>";
	 
	 if (isset($pdata["pbcomments"]))
     $xml .= "<comments>" . $pdata["pbcomments"] . "</comments>";
	 
	 if (isset($pdata["pbordertype"]))
	 {
   $xml .= "<action>";
    
   if ($pdata["pbordertype"] == "PbOrder_Submit") 
  	 $xml .= "submit";
   
   elseif($pdata["pbordertype"] == "PbOrder_Modify")
  	 $xml .= "modify";
   
   elseif($pdata["pbordertype"] == "PbOrder_Cancel")
  	 $xml .= "cancel";
   
   $xml .= "</action>";
	 }

	 $xml .= "</periodic>";
 }
 
 //___________________________________________

 $xml .= "<transactiondetails>";

 if (isset($pdata["transactionorigin"]))
	 $xml .= "<transactionorigin>" . $pdata["transactionorigin"] . "</transactionorigin>";
 
 if (isset($pdata["oid"]))
	 $xml .= "<oid>" . $pdata["oid"] . "</oid>";
 
 if (isset($pdata["reference_number"]))
	 $xml .= "<reference_number>" . $pdata["reference_number"] . "</reference_number>";
 
 if (isset($pdata["ponumber"]))
	 $xml .= "<ponumber>" . $pdata["ponumber"] . "</ponumber>";
       
 
 if (isset($pdata["recurring"]))
 {
	 if (strtoupper($pdata["recurring"]) == "RECURRING_TRANSACTION")
   $xml .= "<recurring>yes</recurring>";
	 elseif (strtoupper($pdata["recurring"]) == "NON_RECURRING_TRANSACTION")
   $xml .= "<recurring>no</recurring>";
 }
 
 if (isset($pdata["taxexempt"]))
   $xml .= "<taxexempt>" . $pdata["taxexempt"] . "</taxexempt>";
 elseif (isset($pdata["taxexmpt"]))
	 $xml .= "<taxexempt>" . $pdata["taxexmpt"] . "</taxexempt>";
	 
	 
 if (isset($pdata["terminaltype"]))
 {
	 if (strtoupper($pdata["terminaltype"]) == "TTYPE_UNSPECIFIED")
   $xml .= "<terminaltype>unspecified</terminaltype>";
	 elseif (strtoupper($pdata["terminaltype"]) == "TTYPE_STANDALONE")
   $xml .= "<terminaltype>standalone</terminaltype>";	
	 elseif (strtoupper($pdata["terminaltype"]) == "TTYPE_POS")
   $xml .= "<terminaltype>pos</terminaltype>";	
	 elseif (strtoupper($pdata["terminaltype"]) == "TTYPE_UNATTENDED")
   $xml .= "<terminaltype>unattended</terminaltype>";
       }
 
 if (isset($pdata["ip"]))
	 $xml .= "<ip>" . $pdata["ip"] . "</ip>";
 elseif (isset($pdata["Ip"]))
	 $xml .= "<ip>" . $pdata["Ip"] . "</ip>";
       
 if (isset($pdata["tdate"]))
	 $xml .= "<tdate>" . $pdata["tdate"] . "</tdate>";
 

 if (isset($pdata["mototransaction"]))
 {
	 if ($pdata["mototransaction"] == "MOTO_TRANSACTION")	
   $xml .= "<transactionorigin>moto</transactionorigin>";
	 
	 elseif ($pdata["mototransaction"] == "RETAIL_TRANSACTION")	
   $xml .= "<transactionorigin>retail</transactionorigin>";
	 
	 elseif ($pdata["mototransaction"] == "ECI_TRANSACTION")	
   $xml .= "<transactionorigin>eci</transactionorigin>";
 }
 
 if (isset($pdata["tdate"]))
	 $xml .= "<tdate>" . $pdata["tdate"] . "</tdate>";
 
 $xml .= "</transactiondetails>";


 if (isset($pdata["comments"]) || isset($pdata["referred"]))
 {
	 $xml .= "<notes>";
 
	 if (isset($pdata["comments"]))
   $xml .= "<comments>" . $pdata["comments"] . "</comments>";

	 if (isset($pdata["referred"]))
   $xml .= "<referred>" . $pdata["referred"] . "</referred>";

	 $xml .= "</notes>";
 }

 $xml .= "</order>";    

 return $xml;
}
}
?>

hope this helps whoever works fine for me


Do what you do best!!

Share this post


Link to post
Share on other sites

I uploaded the replacement lpphp.php file and I'm still getting the same response: after running a test credit card process I end up with a blank page here: checkout_process.php

I'm wondering if cURL is not configured on my server and not executing? Is this the type response one may get if cURL is not installed?

Thanks

Share this post


Link to post
Share on other sites

First post. Having Linkpoint problems on the confirmation. Here's what I'm getting:

PHP Fatal error: Call to undefined function: curl_init() in...catalog\includes\linkpoint\lpphp.php on line 166.

 

Anyone tell me what's going on here? I've searched the boards, but can't seem to find a work-around. Under deadline as usual. thanks.

Share this post


Link to post
Share on other sites

Sorry, here's where my line 166 is:

 

? ? ? ?$ch = curl_init ();

? ? ? ? ? ?curl_setopt ($ch, CURLOPT_URL,$host);

? ? ? ? ? ?curl_setopt ($ch, CURLOPT_POST, 1);

? ? ? ? ? ?curl_setopt ($ch, CURLOPT_POSTFIELDS, $xml);

? ? ? ? ? ?curl_setopt ($ch, CURLOPT_SSLCERT, $key);

? ? ? ? ? ?curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

? ? ? ? ? ?curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);

? ? ? ? ? ? ? ? ? ? ? ?curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);

Share this post


Link to post
Share on other sites

well what do you know.... it works...

 

the post by jbireton on Jul 2 2004, 06:58 PM was just what I needed ... just took a little longer than I wished to figure out what lines were being referred to.

Share this post


Link to post
Share on other sites
well what do you know.... it works...

 

the post by jbireton on Jul 2 2004, 06:58 PM  was just what I needed ... just took a little longer than I wished to figure out what lines were being referred to.

 

What lines were being referred to??????? :blink:

Share this post


Link to post
Share on other sites
What lines were being referred to??????? :blink:

 

I later found out that I didn't work. I ended up unistalling the linkpoint contribution and found a more recent contribution at http://www.oscommerce.com/community/contri...earch,Linkpoint

 

It had better instructions and I was able to determine that my client did not added the right plan to his merchant account.

 

I don't remember anymore what the lines were but I didn't end up using it. If you downloaded the contribution I mentioned in the first paragraph and still need help finding the lines, then let me know or you can contact the author of the contribution directly. He offers free support on this contribution.

Share this post


Link to post
Share on other sites

I am also getting the "There has been an error processing your credit card, please try again : Could not execute curl" error message.

 

I've tried solutions provided in this thread but still no luck? Does anyone else have a working version of lpphp.php for v2.0.007 20 jan 2003 that they are kinda enough to share? Thanx in advance.... :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup:

Share this post


Link to post
Share on other sites

I am also getting the "There has been an error processing your credit card, please try again : Could not execute curl" error message.

 

I've tried solutions provided in this thread but still no luck? Does anyone else have a working version of lpphp.php for v2.0.007 20 jan 2003 that they are kinda enough to share? Thanx in advance.... :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup:

[/quote

 

After trying everything that I could think of from the osCommerce side of my site, I contacted Linkpoint. One of their techs went over my site and the only thing that he was able to find was a .pem file had the correct data but was in the wrong format (there were blank lines in between the data). He replace the file and BAM! it worked perfectly. I couldn't believe that something so easy had become sooooo difficult. :blush: :-" :D

Share this post


Link to post
Share on other sites

I have had no luck with the linkpoint module. Getting the dreaded cannot execute curl message. Been following this thread closely but no solutions so far. Installed the latest module twice now and even did a complete install of the site. No luck. Yes I got the .pem file sent to me as well. Is it the store ID# that is the name of the file in my case a ten digit number or the user ID#? Currently trying the store ID.

Share this post


Link to post
Share on other sites

In turns out the reason I was getting the "Could not execute curl" error message was due to the fact that the linkpoint account wasn't setup. After I've correctly setup the payment module and pem file I'm having a different problem. On the /checkout_confirmation.php page i would click on confirm order and the page submits goes to either /checkout_process.php and displays a default friendly IE message "The page cannot be displayed" or would hang at the /checkout_confirmation.php page.

 

Has anyone encountered the same problem or does anyone have any ideas on how to resolve thi?

 

Thank you and advance...

Share this post


Link to post
Share on other sites

If you ever get that 'page cannot be displayed' error, it probably means you're using the Connect module. Call Linkpoint and make sure you have Connect added to your account. You can tell if you login to www.linkpointcentral.com, go to Customization, and there should be a 'settings' button at the bottom.

 

In turns out the reason I was getting the "Could not execute curl" error message was due to the fact that the linkpoint account wasn't setup.  After I've correctly setup the payment module and pem file I'm having a different problem.  On the /checkout_confirmation.php page i would click on confirm order and the page submits goes to either /checkout_process.php and displays a default friendly IE message "The page cannot be displayed" or would hang at the /checkout_confirmation.php page.

 

Has anyone encountered the same problem or does anyone have any ideas on how to resolve thi?

 

Thank you and advance...

Share this post


Link to post
Share on other sites

Hello everyone. Mr Robinson:

 

Well, I have the similar runningprobelm with the curl execution, but with a twist. First a few things about my site:

 

A) Heavily modified OSC. Only one payment module: linkpoint

B)Running the Register Globals Contribution version with register_globals = off.

C) Client is using the Linkpoint API service.

D) The version I installed is the latest LinkpointMS1andMS2_1_3_1.zip by Mr. Murphy.

E) My server config cURL field reads: CURL support = enabled

CURL Information = libcurl 7.9.5 (OpenSSL 0.9.6b) (ipv6 enabled)

F) Running the store in "good" mode, but I have no access to the Linkcentral account. Client does not trust me with access to it.

 

To start with:

 

A) All my error messages are not being shown in the page, only in the url address. Thsi means when I process the card. I get sent back to the CC page, but I see no error message anywhere. I do, however, see the following in URL address field

 

http://..........error_message=There+has+been+an+error+processing+your+credit+card%2C+please+try+again+:%20Could%20not%20execute%20curl

 

Could this be a rgister_globals = off issue.

 

B) Like the rest of you , I get the Could Not Execute curl message.

 

 

First, if anything I would like to take care of the error message issue, which seem to me like a simpler fix. I am also going to harras me client to get me access to teh Linkcentral admin side, or maybe use one of their test stores instead.

 

Anyone used the test store to create a OSC site?...

 

Thanks in advance

Share this post


Link to post
Share on other sites

Call into Linkpoint support and ask for a new PEM file. If you have the storenumber, they should be able to get it for you with no problem. Thats the first thing you should try- corrupt or incorrect PEM files give the Could Not Execute Curl error. (or Curl not being in phpinfo()).

 

 

 

Hello everyone. Mr Robinson:

 

Well, I have the similar runningprobelm with the curl execution, but with a twist. First a few things about my site:

 

A) Heavily modified OSC. Only one payment module: linkpoint

B)Running the Register Globals Contribution version with register_globals = off.

C) Client is using the Linkpoint API service.

D) The version I installed is the latest LinkpointMS1andMS2_1_3_1.zip by Mr. Murphy.

E) My server config cURL field reads: CURL support = enabled

                                            CURL Information = libcurl 7.9.5 (OpenSSL 0.9.6b) (ipv6 enabled)

F) Running the store in "good" mode, but I have no access to the Linkcentral account. Client does not trust me with access to it.

 

To start with:

 

A) All my error messages are not being shown in the page, only in the url address. Thsi means when I process the card. I get sent back to the CC page, but I see no error message anywhere. I do, however, see the following in URL address field

 

http://..........error_message=There+has+been+an+error+processing+your+credit+card%2C+please+try+again+:%20Could%20not%20execute%20curl

 

Could this be a rgister_globals = off issue.

 

B) Like the rest of you , I get the Could Not Execute curl message.

First, if anything I would like to take care of the error message issue, which seem to me like a simpler fix. I am also going to harras me client to get me access to teh Linkcentral admin side, or maybe use one of their test stores instead.

 

Anyone used the test store to create a OSC site?...

 

Thanks in advance

Share this post


Link to post
Share on other sites
Call into Linkpoint support and ask for a new PEM file.  If you have the storenumber, they should be able to get it for you with no problem.  Thats the first thing you should try- corrupt or incorrect PEM files give the Could Not Execute Curl error. (or Curl not being in phpinfo()).

 

I had this problem too. For me, my problem was the store .pem file. Apparently, I needed to upload that file in ASCII mode in order for it to work (previously uploaded binary). Once I did that, worked like a charm.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×