cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

troubleshooting cURL

From: Mark Steudel <msteudel_at_panicware.com>
Date: Fri, 17 Dec 2004 15:22:02 -0800

Hi Everyone,

We are using cURL to process credit card forms on our website. Here's the
code:

// set URL
$url = curl_init("https://secure.authorize.net/gateway/transact.dll");

// New Curl commands
curl_setopt($url, CURLOPT_HEADER, 0);
curl_setopt($url, CURLOPT_POST, 1);
curl_setopt($url, CURLOPT_POSTFIELDS, $strPost);
curl_setopt($url, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($url, CURLOPT_REFERER,
"http://www.panicware.com/auth_net_ccorderstart.php");
curl_setopt($url, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($url);

// break gateway response into an array
$v = explode ( ":", $data );

// get curl session info
$curlInfo = curl_getinfo ( $url );

// get curl error
$curlError = curl_error($url);

// log into database
mysql_query( "INSERT INTO orderlog ( id, orderid, response, transactionid,
curltrace, action, curlerror ) VALUES ( '', '$strOrderID', '$data', '$v[6]',
'$curlInfo', 'auto', '$curlError' )" );

// Close curl sessions
curl_close($url);

Problem: The cURL command gets executed but sometimes it never returns any
values back to the script that calls it. I know it executed because the
credit card gateway has the transaction recorded.

VERSIONS:
PHP: 4.3.3
OS: Red Hat 7.3
Apache: 1.3.33
Curl: libcurl 7.9.5 (OpenSSL 0.9.6b) (ipv6 enabled)

I'm spinning my wheels on how to figure out what is causing these occasional
hiccups.

Thanks, Mark
Received on 2004-12-18