Please tell me what i'm doing thats so wrong.
Code: Select all
$x_login = '*********';
$x_fp_sequence = mt_rand();
$x_fp_timestamp = time();
$x_fp_hash = hmac('****************', $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount);
$post = array(
'x_test_request' => 'TRUE',
'x_login' => $x_login,
'x_fp_sequence' => $x_fp_sequence,
'x_fp_timestamp' => $x_fp_timestamp,
'x_fp_hash' => $x_fp_hash,
// 'x_method' => 'CC',
'x_show_form' => 'PAYMENT_FORM',
// 'x_relay_response' => 'TRUE',
// 'x_relay_url' => 'http://Domain.com/test.php?q=abc',
'x_amount' => $x_amount
);
echo '<pre>';
print_r($post);
$ch=curl_init('https://test.authorize.net/gateway/transact.dll');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
curl_exec($ch);
curl_close($ch);
function hmac ($key, $data)
{
return (bin2hex (mhash(MHASH_MD5, $data, $key)));
}