Hi,

I'm quite new to web design and PHP and I'm hoping that one of you Gurus of PHP can give me a little guidance.

The technology I use is an encryption script that is used by Barclays ePDQ mechant accounts. Could anybody please break this script down for me and tell me what field are required?

<?php

#the following function performs a HTTP Post and returns the whole response
function pullpage( $host, $usepath, $postdata = "" ) {

open socket to filehandle(epdq encryption cgi)

$fp = fsockopen( $host, 80, &$errno, &$errstr, 60 );

#check that the socket has been opened successfully
if( !$fp ) {
print "$errstr ($errno)<br>\n";
}
else {

#write the data to the encryption cgi
fputs( $fp, "POST $usepath HTTP/1.0\n");
$strlength = strlen( $postdata );
fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
fputs( $fp, "Content-length: ".$strlength."\n\n" );
fputs( $fp, $postdata."\n\n" );

#clear the response data

$output = "";

#read the response from the remote cgi 
#while content exists, keep retrieving document in 1K chunks
while( !feof( $fp ) ) {
    $output .= fgets( $fp, 1024);
}

#close the socket connection
fclose( $fp);

}

#return the response
return $output;
}

#define the remote cgi in readiness to call pullpage function
$server="secure2.epdq.co.uk";
$url="/cgi-bin/CcxBarclaysEpdqEncTool.e";

#the following parameters have been obtained earlier in the merchant's webstore
#clientid, passphrase, oid, currencycode, total
$params="clientid=$clientid";
$params.="&password=$passphrase";
$params.="&oid=$oid";
$params.="&chargetype=Auth";
$params.="&currencycode=$currencycode";
$params.="&total=$total";

#perform the HTTP Post
$response = pullpage( $server,$url,$params );

#split the response into separate lines
$response_lines=explode("\n",$response);

#for each line in the response check for the presence of the string 'epdqdata'
#this line contains the encrypted string
$response_line_count=count($response_lines);
for ($i=0;$i<$response_line_count;$i++){
if (preg_match('/epdqdata/',$response_lines[$i])){
$strEPDQ=$response_lines[$i];
}
}
?>

<FORM action="https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdq.e" method="POST">
<?php print "$strEPDQ"; ?>
<INPUT type="hidden" name="returnurl" value="http://www.store.co.uk/">
<INPUT type="hidden" name="merchantdisplayname" value="My Store">
<INPUT TYPE="submit" VALUE="purchase">
</FORM>

Okay, the fields that I do know are the passphrase, currency code (for UK pound), and my client ID. Thats about it though.

Now when I am redirected to the ePDQ page I get an error message saying that my encryption data is not present.

I know that there are some fields that are missing but I'm not sure what to put there.

Thanks for your support 🙂

Terry

    Your best bet is to contact Barclays and ask for assistance as they know their ePDQ product

    GM

      Thanks for the reply Trooper.

      I tried Barclays but they can give no programming assistance as they have no programmers employed at their ePDQ depot. The online documentation is far too adept than they first made it out to be. When I first phoned them they said it would be a simple <form> script that would be implemented behind my submit button but after I signed I found that I have to use technologies such as PHP, ASP and Perl, technologies I am a beginner at. They keep referring me to their 'preferred partners' to get them to integrate my ePDQ account which I think is bang out of order seeing as they charge £150+ for this service. What is more frustrating is the fact that I have already paid for ePDQ services and they should offer a more detailed support system than they already have rather than trying to get their partners more cash from their devoted customers.

      My bet is that this system is fixed to do this as they would get their commission rates from these other sites. Methinks this is why they offer a great transaction rates

      Anyway, thats my moan about ePDQ over with 😉

      Oh Worldpay, why did I turn you down? 🙁

        a year later

        Did you get this sorted?

        I've just started reading all of the bumff that comes with the ePDQ, and it sounds simple to me.

        Let me know how you got on.

          7 years later

          Hi,
          I am in the same boat. I have a simple website form to collect a deposit payment for a holiday home and need to integrate the Barclays ePDQ but I am new to PHP or Perl or any of the other scripts it ask you to use. They refer you back to their integration document of which I keep going through but without someone guiding you on whether you are doing the correct thing, you are at a loss!
          I think I have got most of the code setup but I am stuck on the encryption tool as it keeps telling me that "encrypted data not present" so I know that part is not right.
          Additionally, whether to choose Perl or PHP, I dont know either and am trying to do it blind. Can anyone assist me?
          Regards,
          Jo

            to be honest your best bet is dump Barclays and go with Paypal (it's more or less free after all)

            I wouldn't recommend the others e.g. Worldpay, Barclaycard, HSBC (which I've worked with) or Barclays (which I haven't ) to a beginner
            I'd say you need some experience first otherwise it's likely to be a long haul

              Thanks I wish I could but I run the site and the owner banks with Barclays and wants it implemented so its a case of do it or lose it!
              Cheers anyway

                you can always come back with specific questions..

                  Write a Reply...