Hi All,
I've being doing some google work here with this problem, and don't
seem to be able to come up with a good enough answer.
My problem is with Libcurl compiled into PHP. I am using it to post some
XML to a server (See method below.), however I don't seem to be able to
detect correctly if there was a timeout in connecting to the server, or
curl otherwise fails.
This has the effect of passing what should be an invalid trasaction
along. Anyone got a pointer or 77 for me.
Thanks in advance
AJ
private function PostTransaction ($xml,$server) {
settype($xml, "string");
settype($server, "string");
// Begin CURL.
$curl = curl_init();
// CURL Options.
curl_setopt($curl, CURLOPT_URL, $server);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_USERAGENT, "Geeky Option");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_DNS_CACHE_TIMEOUT, 600);
// Execute the CURL command and get the result.
$response = curl_exec ($curl);
curl_close ($curl);
if(!$response) {
return false;
}
return $response;
}
--
ILUG Web Development
http://mail.linux.ie/mailman/listinfo/webdev/
|