Page 2 of 2

Posted: Fri Feb 23, 2007 3:48 am
by BachgenCymreig
UGH I haven't had a chance to reply with work :@

Ok so I tried removing the '@' operator before fsockopen and now I get an error message:
Warning: fsockopen() [function.fsockopen]: unable to connect to irc.com:6667 in /home/cymru/public_html/alpha/registernick.php on line 30

Code: Select all

set_time_limit(0);

$server_host = "irc.com";
$server_port = "6667";

$nickname = $nick;


$server = array(); //we will use an array to store all the server data.

$server['SOCKET'] = fsockopen($server_host, $server_port, $errno, $errstr, 2);
if($server['SOCKET'])
{
  SendCommand("NICK $nickname\n\r"); 
  SendCommand("USER $nickname test test :IRC.com NickRegBot\n\r");
}
btw irc.com isn't the real server but the actual server I am trying to get it connecting to is up and running and the above script works to connect on my website, just not my friends. Really annoying me now lol

Any further help greatly appreciated - Thanks!

Posted: Wed Feb 28, 2007 3:02 am
by BachgenCymreig
Am I allowed to ask again now? :oops: Helppppppp someone! lol

Posted: Wed Feb 28, 2007 4:39 am
by daedalus__
Dood.

Fix this:

Warning: fsockopen() [function.fsockopen]: unable to connect to irc.com:6667 in /home/cymru/public_html/alpha/registernick.php on line 30

Try again.

Where is the definition for SendCommand?

Did you write this script?

Try this:

Code: Select all

$server_host = "irc.com";
$server_port = "6667";

$nickname = $nick; <-- where the heck did $nick come from?

// we could have used an array to store all the server data but since only the socket is in there, an array is a waste of memory.

$sr = fsockopen($server_host, $server_port, $errno, $errstr, 2) or print('Could not open socket:<br />');

if($sr != false)
{
   SendCommand("NICK $nickname\n\r");
   SendCommand("USER $nickname test test :IRC.com NickRegBot\n\r");
}
else
{
   // the MANUAL states that if the error number is 0 or if fsockopen() returns false then there was probably a problem initializing the socket
   echo $errno.'<br />'.$errstr.'<br />';
}
Tell your friend to turn off Register Globals to see if it helps, if he refuses, refuse to help him. :P

EDIT: Please, learn how to do basic error checking.