Ok, I tried something new this time. I found a post on the osC boards on testing cURL. It's pretty basic, it takes the code out of the Authorize.net payment module and tries to make a connection. If cURL is working properly you should get an Invalid Merchant ID or password error since we are not passing any data. Here is the code -
PHP Code:
<?php
$url = "https://secure.authorize.net/gateway/transact.dll";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //Windows 2003 Compatibility
$authorize = curl_exec($ch);
curl_close($ch);
$response = split(",", $authorize);
print_r($response);
?>
When I run the script, it works and I get the error 13.
I also ran another script that tries to make an HTTP connection, as well as an HTTPS connection. This time I get a certificate error and the SSL page doesn't load properly. I am starting to think that it may actually be related to Plesk. What server admin software are other people using? Oh, here is the other test code to try -
PHP Code:
<?
/*
file created on 2/23/2004 to test CURL
*/
function ssl_connect($url,$variables=0,$parse_variables=0,$test=0,$timeout=30,$no_headers=0){
global $SC;
define(UMURL,$url);
define(UMTIMEOUT,$timeout);
// check for presence of CURL
if (!function_exists("curl_init")){
// only display CURL error message if it hasn't been displayed before
if (!$SC['no_curl']) print "\n<!-- Squirrelcart Error: You are using a service which requires CURL, and it is not enabled on your web server. -->";
$SC['no_curl'] = 1;
return;
}
// if URL has https in it, check for presence of OpenSSL
$ch = curl_init(UMURL);
// set some options for the connection
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT,UMTIMEOUT);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
if (strtoupper(substr(PHP_OS,0,3)) == 'WIN') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line fixes SSL communications on some Windows servers (IIS 5.0?)
}
//curl_setopt($ch,CURLOPT_VERBOSE,1);
// attach the data
//print "query is $query<br>";
// run the transfer
$result=curl_exec ($ch);
if(curl_errno($ch) > 0) echo "<p style='color: red'><b>cURL ERROR#".curl_errno($ch).": ".curl_error($ch)." at ".__LINE__." in ".__FILE__."</b></p>";
curl_close ($ch);
return $result;
}
print "<html><head><title>CURL Test Page</title></head><body style=\"font-family: verdana, helvetica, tahoma; font-size: 12pt\"><b>CURL Test Page</b><br><br>To test a regular HTTP connection via curl to http://www.ebay.com,
<br>
<a href=\"?method=normal\">click here</a><br><br>
";
print "To test a secure HTTPS (SSL) connection via curl to https://adwords.google.com/select/
<br>
<a href=\"?method=secure\">click here</a><br>";
if ($HTTP_GET_VARS['method']) {
print "<br><b>If a page is displayed below, the test worked. Do not worry about broken image tags. As long as you have some output from the page below the test is valid:</b><hr width=\"100%\" height=\"2\"><br><br>";
if ($HTTP_GET_VARS['method'] == "normal") $page = "http://www.ebay.com";
if ($HTTP_GET_VARS['method'] == "secure") $page = "https://adwords.google.com/select/";
$page_data = ssl_connect($page);
print $page_data;
}
print "</body></html>";
?>
At this point I am pretty certain that it is related to how the server is set up and how the Zen Auth.net AIM module is coded. I am going to compare the osC module to the Zen module and see if there are any significant differences that would break the module. It is definitely not an Authorize.net problem.
Bookmarks