View Full Version : OSCommerce and ePDQ

11-21-2002, 02:52 PM
how to modified OScommerce to be able to used it with ePDQ automated Online payment? if someone know how it would be so amazing, if not I will have no choose to use one of their affiliate developement team, which mean not using OScommerce, which suck cause I just LOVE it.

here the files that came with the ePDQ account:



#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 = pfsockopen( $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

#the following parameters have been obtained earlier in the merchant's webstore
#clientid, passphrase, oid, currencycode, total

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

#split the response into separate lines

#for each line in the response check for the presence of the string 'epdqdata'
#this line contains the encrypted string
for ($i=0;$i<$response_line_count;$i++){
if (preg_match('/epdqdata/',$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">



if (!strcmp(getenv("REQUEST_METHOD"),"POST")){

$path=""; #set your logfile directory path here



fwrite($FILE,"OrderID - $oid\n");

fwrite($FILE,"Transaction Status - $transactionstatus\n");

fwrite($FILE,"Total - $total\n");

fwrite($FILE,"ClientID - $clientid\n");

fwrite($FILE,"Transaction Time Stamp - $datetime\n");