i'm trying to connect with curl on a server that has wamp installed but i get connection refused Failed to connect to centrala.ratt.ro port 47654: Connection refused
and i don't know why. If i access the link in browser it works, with php curl it's not working. Here is my code:
$url = "http://centrala.ratt.ro:47654/webhook/coordonate.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_PORT, 47654);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode ($result));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, 0);
// This should be the default Content-type for POST requests
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
$rezult = curl_exec($ch);
echo $rezult;
if(curl_exec($ch) === false)
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
echo 'Operation completed without any errors';
}
curl_close($ch);