If using PHP, download the SDK:
http://developer.authorize.net/downloads/
Go into the doc folder inside that, look for the AIM.markdown and ARB.markdown files. They're fairly straightforward. Here's an example for silent post that I edited from one I'm using on a client site. Hopefully no syntax errors, note that you'll need to replace the database calls with whatever you use for interfacing with your database, and change the path on the log file.
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/library/mysql.php');
$logfile = "{$_SERVER['DOCUMENT_ROOT']}/logs/callback.txt";
$handle = fopen($logfile, 'a');
// Eliminate fields I don't want to log
foreach (array('x_method', 'x_account_number', 'x_phone', 'x_fax', 'x_email', 'x_invoice_num', 'x_type', 'x_ship_to_first_name', 'x_ship_to_last_name', 'x_ship_to_company', 'x_ship_to_address', 'x_ship_to_city', 'x_ship_to_state', 'x_ship_to_zip', 'x_ship_to_country', 'x_tax', 'x_duty', 'x_freight', 'x_tax_exempt', 'x_po_num', 'x_cvv2_resp_code', 'x_cavv_response', 'x_test_request') as $key)
unset($_POST[$key]);
fwrite($handle, print_r($_POST, true));
// --------------------------------------------
if ($_POST['x_response_code'] == 1 && $_POST['x_cust_id']) {
if (!$link = db_connect()) {
fwrite($handle, "Unable to connect to database.\n");
exit;
}
// Log payment entry in database
$query = queryMysql("
INSERT INTO payments SET company = {company}, payment = {payment}, type = 'MONTHLY', paid = NOW()",
array(
company => $_POST['x_cust_id'],
payment => $_POST['x_amount']
));
if (!$result = mysql_query($query, $link))
fwrite($handle, "ERROR: Unable to add payment record to database.\n");
else
fwrite($handle, "Payment record added to database.\n");
$query = queryMysql("
UPDATE companies SET payment_due = payment_due + INTERVAL 1 MONTH WHERE idn = {company}",
array(
company => $_POST['x_cust_id']
));
if (!$result = mysql_query($query, $link))
fwrite($handle, "ERROR: Unable to update company expiration date.\n");
else
fwrite($handle, "Company expiration date updated.\n");
}
else fwrite($handle, "ERROR: Bad response code and/or missing customer ID.\n");
// So I can see if it works when I call it myself
print 'Ran';
?>