Hello Lorna,

Your blog was extremely helpful, I would like to thank you for that. I have a small problem.

I am communicating with web service for adding and updating an element, and on localhost, it works perfectly fine, but on the live server, it is giving me a status 0 error. For adding and updating an element, I am associating a port number with the web service URL. Here is my code.

$ch = curl_init(‘http://int.otono-me.com:8999/api/customers/new’);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “PUT”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_PORT, 8999);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“Content-Type: application/json”,
“X-Auth-Token: ” . $_SESSION[“Token”]
));

$result = curl_exec($ch);
$curl_errno = curl_errno($ch);
$curl_error = curl_error($ch);
if($curl_errno > 0) {
echo “cURL Error ($curl_errno): $curl_error\n”;
} else {
echo “Successful\n”;
}
curl_close($ch);

echo $result;

On Localhost, the above code works perfectly fine, but on the live server, I get this error:

cURL Error (7): connect() timed out!

Do I need to make certain changes in the above code to ensure that it works with on the live server?

Looking forward for your response,

Thank you,

Mandar CHITALE