I am trying to add information into the rest web service at a particular port number: 8999. On localhost, it is working fine but on the live server, it gives the following error:
cURL Error (28): connect() timed out!
Here is the 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;
Any suggestion on what needs to be done?
Either you have a proxy on the live system, or a firewall in between.
Ask your local sysop for changes regarding firewall.
You are also missing a ':
$ch = curl_init('http://int.otono-me.com:8999/api/customers/new');
// -------^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With