Hello;
I'm trying to get my web site to connect to the Authorize.net gateway. They (Authorize.net) e-mailed me a script that is supposed to let my web site connect to the Authorize.net gateway.
The cURL part of the script does not seem to be working.
// Note: The values for the array are passed to
// this page from a form on a previous page.
$authnet_values = array("x_login" => $x_login,
"x_tran_key" => $x_tran_key,
"x_version" => $x_version,
"x_delim_data" => $x_delim_data,
"x_delim_char" => $x_delim_char,
"x_relay_response" => $x_relay_response,
"x_amount" => $x_amount,
"x_type" => $x_type);
$fields = ""; // Turns array into string.
foreach( $authnet_values as $key => $value ) {
$fields .= "$key=" . urlencode( $value ) . "&";
}
// This is supposed to send the data to the Authorize.net server
// and then send back a response - but it doesn't.
$ch = curl_init("https://test.authorize.net/gateway/transact.dll");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " ));
$resp = curl_exec($ch); // It's getting stuck here.
curl_close ($ch);
The script won't connect my web site to the Authorize.net server. It stops executing at the curl_exec($ch) part of the script.
Does anyone have any suggestions about where I might look to troubleshoot to find the problem?
Thanks.