// error_reporting(E_ALL); if ($_SERVER["HTTPS"]!="on") { header('location: https://www.ainadshriners.org/payments/'); } $action=$_REQUEST['action']; // --------------------------------------------- SETUP GATEWAY if ($action=='confirm') { $name_f=$_REQUEST['name_f']; $name_l=$_REQUEST['name_l']; $mid=$_REQUEST['mid']; $addr=$_REQUEST['addr']; $cty=$_REQUEST['cty']; $st=$_REQUEST['st']; $zip=$_REQUEST['zip']; $dPhone=$_REQUEST['dPhone']; $ePhone=$_REQUEST['ePhone']; $ema=$_REQUEST['ema']; $payfor=$_REQUEST['payfor']; $other=$_REQUEST['other']; $amt=str_replace('$', '', $_REQUEST['amt']); $cardType=$_REQUEST['cardType']; $cardNbr=str_replace('-', '', $_REQUEST['cardNbr']); $xMth=$_REQUEST['xMth']; $xYr=$_REQUEST['xYr']; $cvm=$_REQUEST['cvm']; $cvmna=$_REQUEST['cvmna']; } // --------------------------------------------- PROCESS PAYMENT if ($action=='processPmt') { $name_f=$_REQUEST['name_f']; $name_l=$_REQUEST['name_l']; $mid=$_REQUEST['mid']; $addr=$_REQUEST['addr']; $cty=$_REQUEST['cty']; $st=$_REQUEST['st']; $zip=$_REQUEST['zip']; $dPhone=$_REQUEST['dPhone']; $ePhone=$_REQUEST['ePhone']; $ema=$_REQUEST['ema']; $payfor=$_REQUEST['payfor']; $other=$_REQUEST['other']; $amt=str_replace('$', '', $_REQUEST['amt']); $cardType=$_REQUEST['cardType']; $cardNbr=str_replace('-', '', $_REQUEST['cardNbr']); $xDate=$_REQUEST['xDate']; $cvm=$_REQUEST['cvm']; $cvmna=$_REQUEST['cvmna']; $mailto=$ema.", admin@ainadshriners.org"; if ($payfor=='other') {$payfor=$other;} $post_url = "https://secure.authorize.net/gateway/transact.dll"; $post_values = array( "x_login" => "4P85HbtV", "x_tran_key" => "7Gt3Xe9z46EFBJ98", "x_version" => "3.1", "x_delim_data" => "TRUE", "x_delim_char" => "|", "x_relay_response" => "FALSE", "x_type" => "AUTH_CAPTURE", "x_method" => "CC", "x_card_num" => $cardNbr, "x_exp_date" => $xDate, "x_amount" => $amt, "x_description" => "Payment to Ainad Shriners, E. St. Louis, IL", "x_first_name" => $name_f, "x_last_name" => $name_l, "x_address" => $addr, "x_city" => $cty, "x_state" => $st, "x_zip" => $zip, "x_country" => "US", "x_phone" => $dPhone, "x_email" => $ema ); $post_string = ""; foreach( $post_values as $key => $value ) { $post_string .= "$key=" . urlencode( $value ) . "&"; } $post_string = rtrim( $post_string, "& " ); $request = curl_init($post_url); // initiate curl object curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. $post_response = curl_exec($request); // execute curl post and store results in $post_response // additional options may be required depending upon your server configuration // you can find documentation on curl options at http://www.php.net/curl_setopt curl_close ($request); // close curl object // This line breaks the response into an array using the specified delimiting character $response_array = explode($post_values["x_delim_char"],$post_response); // ----- TESTING - PRINT GATEWAY RESPONSE - TESTING // echo "