cancel
Showing results for 
Search instead for 
Did you mean: 

PHP CURL started returning no results

Hey All,

 I have been using my eStore for a few months now, and its been great.  I had no move my servers and obtain new IP's.  I have set up my server (with the SLL certs), and modified all the IPs correctly, they all work and tested fine. However I am having wierd functionality with the CURL statements, they started returning no results almost 80% of the time, and now 100%.  I have used the sample code provided by Authorize.net (with the test login), just to see if it was my code or not, and I am still getting no response from that.

 

My "Send post" function i added an error message to see what was going on:

function sendPost($postURL, $post_string)
{
#echo $post_string;
    // initiate curl object
    $request = curl_init($postURL);
        // set to 0 to eliminate header info from response
        curl_setopt($request, CURLOPT_HEADER, 0);
        // Returns response data instead of TRUE(1)
        curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
        // use HTTP POST to send form data
        curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
        // uncomment this line if you get no gateway response.
        curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
        // execute curl post and store results in $post_response
        $post_response = curl_exec($request);
        // Checks for Errors
        if (curl_errno($request) > 0)
        {
#           $error = curl_getinfo($request);
#           echo "ERROR: <BR>";
#           print_r($error);
            $_SESSION['curl_error'] = curl_getinfo($request);
            $_SESSION['gnc_order_error'] = TRUE;
        }
    curl_close ($request); // close curl object
    return $post_response;
}

 When i echo the results of the return "curl_getinfo" I get :

url = https://secure.authorize.net/gateway/transact.dll
http_code = 0
header_size = 0
request_size = 0
filetime = -1
ssl_verify_result = 0
redirect_count = 0
total_time = 0
namelookup_time = 0
connect_time = 0
pretransfer_time = 0
size_upload = 0
size_download = 0
speed_download = 0
speed_upload = 0
download_content_length = 0
upload_content_length = 0
starttransfer_time = 0
redirect_time = 0

 

I also issued from my command line:

$ curl https://secure.authorize.net/gateway/transact.dll

 and as a response I got :

<HTML><BODY><H3>The following errors have occurred.</H3>(13) The merchant login ID or password is invalid or the account is inactive.<BR></BODY></HTML>

 Soo I have to believe that Curl is properly communicating with authorize.net and there cant be anything wrong with my firewall or router (or IP's for that matter)

 

I have also tried to do all this without directing my website to "https" to see if it is my SSL cert, and that did not work either.

 

I just changed my transactionKey to check that, and still same issue.

 

I am totally stummped and just dont know where to go from here.

Any help would be amazing!

Thanks!

 

joshd
Member
2 REPLIES 2

Do a phpinfo() and see if curl_exec is in the list of disabled functions.

TJPride
Expert

Thanks for the reply, After much frustration, I went back to my network properties, and saw that I did not change the DNS servers to my new hosting facility. Not that I thought it would make a difference, but I changed those IPs and almost immedately my test page worked.

 

Curl was enabled in phpinfo(), thank you.

 

This still makes no sense in my head how it worked after my switch sometimes. 

None the less, I seem to be back up and running.