Jump to content

Using CURL for encryption


dock_boy

Recommended Posts

Hello there,

 

I am integrating the Barclays epdq terminal for a Web site for a friend of mine. I have done this before many times. Its quite straight forward, or it was before doing it on a GoDaddy server with PHP version 4.3.11.

 

When you are integrating the system, Barclays give you thier PHP encryption example which is then customised to suit. They use encryption with fsockopen but unfortuantely the Godaddy servers are not set to accept this command, nor will they be so i'm told.

 

After informing the "ecommerce" support team at Barclays they then gave me a script to use with CURL substituting as the encrpyting method. This too, will not work.

 

Using the fsockopen method, the data was simply not encrypted and thererfore the hidden form field contained nothing.

 

Using the CURL script the server simply hangs on the page giving a few lines of HTML or a blank page completely.

 

Barclays said to make sure CURL was supported on Godaddy and after using the command: <?php var_dump(curl_version()); ?> I got the output 'string(45) "libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.3"' which confirms CURL is installed on the Godaddy servers.

 

I'm basically stuck. Barclays will not accept responsibility for a CURL solution thats works on 4.3.11 and Godaddy do not provide scripting support. I had never heard of or used CURL before so i'm clueless on how to resolve it. I have tried the CURL script on servers with a later PHP version and the encryption string displays confirming it works.

 

Below is the page script that is supposed to encrypt the login data and send it via an encrypted hidden form field.

 

 

/*************************************************************************************

 

<?php

  $url = 'https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdqEncTool.e';

  $params = "clientid=****&password=****&oid=$cust_id&chargetype=Auth&total=$grandtotal&currencycode=826";

  $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

 

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_POST,1);

  curl_setopt($ch, CURLOPT_POSTFIELDS,$params);

  curl_setopt($ch, CURLOPT_URL,$url);

  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);

  curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  // this line makes it work under https

  $result=curl_exec($ch);

  curl_close($ch);

?>

<FORM action="https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdq.e" method="POST">

<?php print "$result";

?>

<INPUT type="hidden" name="returnurl" value="www.example.com/download_tracks.php">

<INPUT type="hidden" name="merchantdisplayname" value="Barclays Suck">

<INPUT TYPE="submit" VALUE="purchase">

</FORM>

 

?**************************************************************

 

This simply hangs and doesnt display on this PHP version. Is there anything that could be removed or added to make this work on 4.3.11?

 

Eternally Grateful

 

The CURL superNoob

 

 

Link to comment
https://forums.phpfreaks.com/topic/56337-using-curl-for-encryption/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.