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 bot cant connect
Moderator: Supporters
Re: php bot cant connect
Firstly, you'll need to wait until AFTER you've received numeric 001 before sending the JOIN. Otherwise, if the server gets it before the PONG for the PING cookie, the server will ignore it.
If JOIN is sent too early the server will respond:
In this example -> is to the server and <- is from the server
On a side note, you're supposed to send NICK before USER.
Also are you aware there is a pre-written PHP class for IRC bots? available on http://pear.php.net
If JOIN is sent too early the server will respond:
Code: Select all
:server.name 451 JOIN :You have not registered
Code: Select all
-> NICK Eboj
<- PING :778B6886
-> USER Eboj localhost * :Eboj
-> PONG :778B6886
<- :server.name 001 Eboj :Welcome to the network IRC Network Eboj!Eboj@localhost
-> JOIN #test
Also are you aware there is a pre-written PHP class for IRC bots? available on http://pear.php.net
Your IP:
Your Country:
Your Country:
-
- Posts: 6
- Joined: Wed Feb 20, 2008 6:15 pm
Re: php bot cant connect
I wont to make my own php bot can someone help me with the code for connecting to an irc server? I can do the rest.
Re: php bot cant connect
You should look up technical specifications on how connections to an IRC server are meant to be made, step by step per protocol, do that and it won't be hard to understand what you need to do in PHP.
Synaptic Technologies | alexisNet | Script System
- nate / synapt -
- nate / synapt -
-
- Posts: 6
- Joined: Wed Feb 20, 2008 6:15 pm
Re: php bot cant connect
Where could I learn all about that?
Re: php bot cant connect
Your IP:
Your Country:
Your Country: