php bot cant connect
Posted: Wed Feb 20, 2008 6:22 pm
i am using a php bot
<?php
// No execution Time limit
set_time_limit(0);
// Opening the socket to the Rizon network
$socket = fsockopen("wes.dnsdojo.com", 6667) or die('Could not connect to the server');
// Send auth info
$nick = 'ellis-bot2';
fputs($socket,"USER CMbot combined-minds.net CM :CM bot\n");
fputs($socket,"NICK $nick\n");
// Join a channel
fputs($socket,"JOIN #wes\n");
// Endless loop until exit.
while(1)
{
// Continue the rest of the script here
while($data = fgets($socket, 128))
{
echo nl2br($data);
flush();
// Separate all data
$ex = explode(' ', $data);
// Respond to PING W/ PONG
if($ex[0] == "PING")
{
fputs($socket, "PONG ".$ex[1]."\n");
}
// Say something in the channel
$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);
switch($command)
{
case ':!sayit':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :Combined-Minds.net irc bot tutorial!\n");
break;
case ':!dienow':
fputs($socket,"PRIVMSG ".$ex[2]." Goodbye cruel world!\n");
die('Session ended.');
break;
default:
}
echo '<pre>';
print_r($ex);
echo '</pre>';
}
usleep(100000);
}
?>
But it wont connect to my unreal ircd but it will conect to another unreal ircd
sometimes it will connect or try to connect to mine but it wont go to channel #wes
and i can connect to it with a irc client and i got it where you can connect with 5 instances from the same ip PLEASE HELP!!!
<?php
// No execution Time limit
set_time_limit(0);
// Opening the socket to the Rizon network
$socket = fsockopen("wes.dnsdojo.com", 6667) or die('Could not connect to the server');
// Send auth info
$nick = 'ellis-bot2';
fputs($socket,"USER CMbot combined-minds.net CM :CM bot\n");
fputs($socket,"NICK $nick\n");
// Join a channel
fputs($socket,"JOIN #wes\n");
// Endless loop until exit.
while(1)
{
// Continue the rest of the script here
while($data = fgets($socket, 128))
{
echo nl2br($data);
flush();
// Separate all data
$ex = explode(' ', $data);
// Respond to PING W/ PONG
if($ex[0] == "PING")
{
fputs($socket, "PONG ".$ex[1]."\n");
}
// Say something in the channel
$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);
switch($command)
{
case ':!sayit':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :Combined-Minds.net irc bot tutorial!\n");
break;
case ':!dienow':
fputs($socket,"PRIVMSG ".$ex[2]." Goodbye cruel world!\n");
die('Session ended.');
break;
default:
}
echo '<pre>';
print_r($ex);
echo '</pre>';
}
usleep(100000);
}
?>
But it wont connect to my unreal ircd but it will conect to another unreal ircd
sometimes it will connect or try to connect to mine but it wont go to channel #wes
and i can connect to it with a irc client and i got it where you can connect with 5 instances from the same ip PLEASE HELP!!!