views:

33

answers:

0

I want to integrate paypoint on site code is following Html coding

<html>
 <head></head
 <body>
  <form name="form1" action="testprocess.php" method="POST">
   <table>
    <tr>
      <td>Description</td>
      <td><input type="text" name="strDesc" id="strDesc"></td>
    </tr>
    <tr>
      <td>Amount</td>
      <td><input type="text" name="fltAmount" id="fltAmount"></td>
    </tr>
    <tr>
     <td>Name</td>
     <td><input type="text" name="strCardHolder" id="strCardHolder"></td>
    </tr>
    <tr>
     <td>E-mail</td>
     <td><input type="text" name="strEmail" id="strEmail"></td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td><input type="Submit" value="Pay"></td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
    </tr>
   </table>
  </form>
 </body>
 </html>

And PHP coding is

<?php
   function ProcessRequest($submit){
     $ch = curl_init('https://secure.metacharge.com/mcpe/corporate?$submit');
     if (!$ch)
     {
       die(sprintf('Error [%d]: %s',
       curl_errno($ch), curl_error($ch)));
     }

     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $submit);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

     //not checking SSL
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     $data = curl_exec($ch);
     if (!$data) 
     {
       die(sprintf('Error [%d]: %s', curl_errno($ch), curl_error($ch)));
     }

     return $data;
   }


      $submit="&strDesc=".urlencode($_REQUEST['strDesc']);
      $submit.="&fltAmount=".urlencode($_REQUEST['fltAmount']);
      $submit.="&strCardHolder=".urlencode($_REQUEST['strCardHolder']);
      $submit.="&strEmail=".urlencode($_REQUEST['strEmail']);
      $submit.="&intTestMode=".urlencode("1");
      $submit.="&intInstID=".urlencode("1234");
      $submit.="&strCartID=".urlencode("228905");
      $submit.="&strCurrency=".urlencode("GBP");
      $submit.="&strPostcode=".urlencode("BA12BU");
      $submit.="&strEmail=".urlencode("[email protected]");
      $submit.="&strCardNumber=".urlencode("1234123412341234");
      $submit.="&intCV2=".urlencode("707");
      $submit.="&strExpiryDate=".urlencode("0610");
      $submit.="&strCardType=".urlencode("VISA");
      $submit.="&strCountry=".urlencode("GB");
      $submit.="&fltAPIVersion=".urlencode("1.3");
      $submit.="&strTransType=".urlencode("PAYMENT");

      $data=ProcessRequest($submit);
      $data_array = explode(",",$data);     
      $passcode = $data_array[0];
      $transactionId = trim($data_array[6]);

      if($passcode==1)
      {
        $statusOfTrans=1;
      }
      else
      {
        $statusOfTrans =0;
        $_SESSION['sess_msg']=$data_array[3];           
        header("location:test.php?id=123");
        exit();
      }

?>

But it is not working. Any one please help