2 // Sends the transaction to us and processes the response into a
4 function curl_tc_send($fields_to_send)
8 foreach ($fields_to_send as $key => $value)
10 if ($use_amp) $post_string .= '&';
11 $post_string .= "$key=$value";
14 $curl_object = curl_init('https://vault.trustcommerce.com/trans/');
15 curl_setopt($curl_object, CURLOPT_RETURNTRANSFER
, 1);
16 curl_setopt($curl_object, CURLOPT_POST
, 1);
17 curl_setopt($curl_object, CURLOPT_POSTFIELDS
, $post_string);
19 $unformatted_results = curl_exec($curl_object);
20 curl_close($curl_object);
21 $result_array = explode("\n", $unformatted_results);
22 $tclink_results = array();
23 foreach ($result_array as $key => $value)
25 $key_pair = explode('=', $value);
26 if (count($key_pair) == 2)
28 $tclink_results[$key_pair[0]] = $key_pair[1];
31 return $tclink_results;
37 'action' => 'preauth',
39 'cc' => '4111111111111111',
41 'address1' => '123 Anywhere St',
45 print_r(curl_tc_send($transaction));