CartMetrix - Do you know yours?

« Minority Report Computer Interface Coming | Home | BBEdit Documents Drawer Disappears »

5/4/2006

ZenCart Authorize.net AIM Module Broken When Using cURL Binary

The ZenCart default Authorize.net AIM (authorizenet_aim.php) module has a problem when using the binary version of cURL.

exec() returns the executed function output as an array. To properly use this array return, we need to pop off the first array element and explode() it at the commas.

Original

// The commented line below is an alternate connection method
//exec("/usr/bin/curl -d "$data" https://secure.authorize.net/gateway/transact.dll", $response);

$url = 'https://secure.authorize.net/gateway/transact.dll'; dv($url); $ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_VERBOSE, 0);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$authorize = curl_exec($ch);

curl_close ($ch);

$response = split('\,', $authorize);

Updated

// The commented line below is an alternate connection method
exec("/usr/bin/curl -d "$data" https://secure.authorize.net/gateway/transact.dll", $response);
//add this line
$response = explode(",", urldecode($response[0]));

/* comment out PHP cURL module usage
$url = 'https://secure.authorize.net/gateway/transact.dll'; dv($url); $ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_VERBOSE, 0);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$authorize = curl_exec($ch);

curl_close ($ch);

$response = split('\,', $authorize);
*/

Popularity: 14%

Trackback:

Related Posts

Post your opinion

Verification Image

Please type the letters you see in the picture.

Subscribe without commenting


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2009 damonparker.org. all rights reserved.

Close
E-mail It