Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection refused error in PHP

[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/

like image 950
chargers2143 Avatar asked Nov 01 '22 11:11

chargers2143


1 Answers

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
like image 99
Phillip Bartschinski Avatar answered Nov 11 '22 07:11

Phillip Bartschinski