Jump to content

IRC socket connect


joethetree

Recommended Posts

Hey,

 

I've had this problem for a couple days now, and haven't been able to work it out.

 

I'm trying to connect to the Gamesurge IRC using PHP - though the code I am using times out and can't connect.

 

I thought it was my code, however I have searched the web for working codes and they all *seem* to do the same basic thing as mine.

 

So if anyone has any ideas as to why I am getting a timeout, I would appreciate it.

 

The code I'm using.

 

<?php

error_reporting(E_ERROR);

$cfg = array(
        "server" => "irc.gamesurge.net",
        "channel" => "#wiremod",
        "port" => 6667,
        "name" => "thetree PHP"
);

echo "Connecting to " . $cfg["server"] . " on port " . $cfg["port"] . "<br/>";
$socket = fsockopen($cfg["server"], $cfg["port"], $errno, $errstr, 5);

if (!$socket) {
        echo("Error[$errno]: $errstr...<br/>");
}
else {
        echo "Socket connection successful..<br/>";
}

fclose($socket);

?>

 

 

Hosted file:

 

http://joethetree.lil.org.uk/socket.php

 

 

 

Thanks

 

thetree

Link to comment
https://forums.phpfreaks.com/topic/223815-irc-socket-connect/
Share on other sites

Is this on a hosted site? Have you checked with the host to make sure you can access that port? All I did was paste it in locally, and got this:

 

Connecting to irc.gamesurge.net on port 6667

Socket connection successful..

Link to comment
https://forums.phpfreaks.com/topic/223815-irc-socket-connect/#findComment-1156873
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.