I've rewritten the code based on the advice not to use $this for variables only used in this function and corrected the really obvious syntax error I missed
public function sendTransaction()
{
foreach(this->authnet_values as $key => $value )
$fields .= "$key=" . urlencode( $value ) . "&";
$ch = curl_init($this->auth_net_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " ));
### curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$this->resp = curl_exec($ch); //execute post and get results
curl_close ($ch);
}
authnet_values is defined in the constructor method
$this->authnet_values = array
(
"x_card_num" => $this->x_card_num,
"x_exp_date" => $this->x_exp_date,
"x_description" => $this->description,
"x_amount" => $this->x_amount,
"x_first_name" => $this->x_first_name,
"x_last_name" => $this->x_last_name,
"x_address" => $this->x_address,
"x_address2" => $this->x_address2,
"x_city" => $this->x_city,
"x_state" => $this->x_state,
"x_zip" => $this->x_zip,
"x_login" => $this->x_login,
"x_version" => $this->x_version,
"x_delim_char" => $this->x_delim_char,
"x_delim_data" => $this->x_data,
"x_type" => $this->x_type,
"x_method" => $this->x_method,
"x_tran_key" => $this->x_tran_key,
"x_relay_response" => $this->x_relay_response,
);