Connection refused error in PHP

chargers2143 picture chargers2143 · Nov 7, 2013 · Viewed 13.6k times · Source

[06-Nov-2013 17:57:32] PHP Warning: socket_connect() [function.socket-connect]: unable to connect [111]: Connection refused in /home2/whoop/public_html/phptesting/main.php on line 43

I keep getting this error. This is a snippet of code in my main.php

<?php

$host = '76.72.172.166';
$port = 25608;

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //Create the socket
$connected = socket_connect($socket, $host, $port);//Try and connect
?>

I am trying to setup a minecraft player list this is what im using http://forums.bukkit.org/threads/web-constantly-updated-website-widgets.148592/

Answer

Phillip Bartschinski picture Phillip Bartschinski · Apr 5, 2016

Try as a UDP connection

$host = '76.72.172.166';
$port = 25608;

$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); //Create the socket
$connected = socket_connect($socket, $host, $port);//Try and connect