curl and php - connection refused
Hello...
We're working with our developer to create a music royalty tracking database for our internet radio station.
We use curl from PHP to pull in "now playing" metadata from our streaming server's "streaminfo" URL.
During development, our developer used his own server to build the system and all was well.
Now that he has moved it over to a cPanel-based server we have commissioned from our hosting company specifically for the purpose, this call no longer works, and neither we (nor our hosting provider) can work out why. We would appreciate some suggestions.
Our new cPanel-based database server has the hostname admin.ourstation.org ; our streaming server we can call streams.ourstation.org (NOTE: domain anonymized).
We're trying to pull in the data from
TEST CODE
"https://streams.ourstation.org:2199/rpc/ourstation/streaminfo.get";
$mysession = curl_init();
curl_setopt($mysession, CURLOPT_URL, $url);
curl_setopt($mysession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mysession, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($mysession, CURLOPT_FAILONERROR, true);
$json = json_decode(curl_exec($mysession), true);
if (curl_errno($mysession)) {
echo "error: " . curl_error($mysession);
}else{
echo json_encode($json,JSON_PRETTY_PRINT);
}
?>
-
Connection Refused sounds like a firewall block. Can you confirm that the firewall on the admin server has the necessary ports open? I'd also whitelist the IP's of the admin server on the streams server and vice versa. 0 -
Hello and thanks for the reply. We don't have direct access to any firewall on the cPanel "admin" machine as far as we are aware, though I have asked our provider to check. We've also asked them to confirm that port 2199 is open too. We don't have access to iptables so we can't whitelist the streams server on the admin machine but I'll ask about that too. The streams server has the admin machine's IP whitelisted - which had no effect. We do not expect the "streams" machine to require any port opening or whitelisting as there is a web server on there (obviously) that we use for stream configuration and accessing the data which works successfully with a web browser pointed at that port. Certainly at this point we certainly tend towards the opinion that some kind of firewall or similar measure is in the way. The "streams" server is a dedicated server and we can do more or less anything we like (except it is working beautifully and I don't want to break it), though I have asked the server provider to confirm that the "admin" server isn't on some blacklist or other with them. With the cPanel "admin" machine we can only access it via the methods provided by cPanel and do not have a shell account. We're running cPanel 78.0.37. We imagine that any firewall setup would be separate and we've asked our provider about that too. Our developer has just let me know that he has been able to access another cPanel server and has tried using curl to connect to "streams" and notes that this fails in the same way as with the "admin" server. So I am wondering if there is a standard or commonly-configured cPanel feature or parameter that might be causing this? As always, many thanks for comments and suggestions. --Richard E 0 -
We don't have direct access to any firewall on the cPanel "admin" machine as far as we are aware, though I have asked our provider to check. We've also asked them to confirm that port 2199 is open too. We don't have access to iptables so we can't whitelist the streams server on the admin machine but I'll ask about that too. The streams server has the admin machine's IP whitelisted - which had no effect.
Ultimately I'm leaning toward the admin server here having the issue here not the stream server, especially since that server doesn't have issues performing this action in conjunction with other servers.With the cPanel "admin" machine we can only access it via the methods provided by cPanel and do not have a shell account. We're running cPanel 78.0.37. We imagine that any firewall setup would be separate and we've asked our provider about that too.
In this case, if you only have access to the cPanel account you wouldn't be able to manage the firewall at all and would need to work with your provider on this.Our developer has just let me know that he has been able to access another cPanel server and has tried using curl to connect to "streams" and notes that this fails in the same way as with the "admin" server. So I am wondering if there is a standard or commonly-configured cPanel feature or parameter that might be causing this?
Not that I'm aware of, it may be that they both run the same firewall software that has the same ports open/closed but this isn't really enough information to make that determination.0
Please sign in to leave a comment.
Comments
3 comments