Page 1 of 1

curl timeout problems

Posted: Thu Dec 07, 2006 1:09 pm
by tsg
I have a script for a payment processor that works on my server, but not working on another. I am wondering if it is a windows/curl issue.

Here is the function:

Code: Select all

function TransmitHTTPRequest($postRequest){	
			$ch=curl_init($this->_sURL);
			if(!$ch)die(sprintf('Error1 [%d]: %s',curl_errno($ch),curl_error($ch)));
			
			curl_setopt($ch, CURLOPT_POST, 1); 
			curl_setopt($ch, CURLOPT_POSTFIELDS,$postRequest);
			curl_setopt($ch, CURLOPT_HEADER,0);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);	
			curl_setopt($ch, CURLOPT_SSLVERSION,3);
			
			$http_response = curl_exec($ch);
			
			if(!$http_response)die(sprintf('Error2 [%d]: %s',curl_errno($ch),curl_error($ch)));
			curl_close($ch);
			
			if($this->_debug)echo "<BR><BR><b>Data received from server:</b><BR><BR>$http_response";
			return $http_response;
		} //END TransmitHTTPRequest
Keep getting Error2 [28] which is: unable to resolve host , CURLE_OPERATION_TIMEOUTED

Like I said works on my server and other servers, but this one doesn't play nice.

FYI,
Windows NT WEBSERVER 5.2
PHP Version 5.2.0
cURL Information libcurl/7.14.0 OpenSSL/0.9.8d zlib/1.2.3

Any help with this error would be greatly appreciated.

Tim

Posted: Thu Dec 07, 2006 2:05 pm
by ok
Add the code below after the function deceleration and post here the output:

Code: Select all

echo $this->_sURL;

Posted: Thu Dec 07, 2006 5:00 pm
by tsg
That displays the merchant URL for the transaction.

The weird this is I get the timeout error immediately. The timeout is set to 120 .. but as soon as the button to process is clicked, it seems to automatically timeout and get that error.

Does this sound like it's not leaving the server?

Posted: Fri Dec 08, 2006 1:43 am
by ok
From what I understand, you have problem in your PHP script (maybe a infinite loop...).