allright i made an irc bot from here http://www.combined-minds.net/tutorials … bot_in_PHP
it wont work and i know it wont work because of the ping pong function because when connecting to my irc it says
by the way my irc is not irc.foonet.com i just have not changed that yet in my irc configuration file
[code]:irc.foonet.com NOTICE AUTH :*** Looking up your hostname…
Array
(
[0] => :irc.foonet.com
[1] => NOTICE
[2] => AUTH
[3] => :***
[4] => Looking
[5] => up
[6] => your
[7] => hostname…
)
:irc.foonet.com NOTICE AUTH :*** Found your hostname
Array
(
[0] => :irc.foonet.com
[1] => NOTICE
[2] => AUTH
[3] => :***
[4] => Found
[5] => your
[6] => hostname
)
PING :DEFC876
Array
(
[0] => PING
[1] => :DEFC876
)
:irc.foonet.com 451 JOIN :You have not registered
Array
(
[0] => :irc.foonet.com
[1] => 451
[2] => JOIN
[3] => :You
[4] => have
[5] => not
[6] => registered
)
:irc.foonet.com 001 ellis-bot2 :Welcome to the ROXnet IRC Network ellis-bot2!CMbot@localhost
Array
(
[0] => :irc.foonet.com
[1] => 001
[2] => ellis-bot2
[3] => :Welcome
[4] => to
[5] => the
[6] => ROXnet
[7] => IRC
[8] => Network
[9] => ellis-bot2!CMbot@localhost
)
:irc.foonet.com 002 ellis-bot2 :Your host is irc.foonet.com, running version Unreal3.2.7
Array
(
[0] => :irc.foonet.com
[1] => 002
[2] => ellis-bot2
[3] => :Your
[4] => host
[5] => is
[6] => irc.foonet.com,
[7] => running
[8] => version
[9] => Unreal3.2.7
)
:irc.foonet.com 003 ellis-bot2 :This server was created Fri Jul 13 19:22:25 2007
Array
(
[0] => :irc.foonet.com
[1] => 003
[2] => ellis-bot2
[3] => :This
[4] => server
[5] => was
[6] => created
[7] => Fri
[8] => Jul
[9] => 13
[10] => 19:22:25
[11] => 2007
)
:irc.foonet.com 004 ellis-bot2 irc.foonet.com Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
Array
(
[0] => :irc.foonet.com
[1] => 004
[2] => ellis-bot2
[3] => irc.foonet.com
[4] => Unreal3.2.7
[5] => iowghraAsORTVSxNCWqBzvdHtGp
[6] => lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
)
:irc.foonet.com 005 ellis-bot2 NAMESX SAFELIST HCN MAXCHANNELS=10 CHANLIMIT=#:10 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=3
Array
(
[0] => :irc.foonet.com
[1] => 005
[2] => ellis-bot2
[3] => NAMESX
[4] => SAFELIST
[5] => HCN
[6] => MAXCHANNELS=10
[7] => CHANLIMIT=#:10
[8] => MAXLIST=b:60,e:60,I:60
[9] => NICKLEN=30
[10] => CHANNELLEN=3
)
2 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 WALLCHOPS :are supported by this server
Array
(
[0] => 2
[1] => TOPICLEN=307
[2] => KICKLEN=307
[3] => AWAYLEN=307
[4] => MAXTARGETS=20
[5] => WALLCHOPS
[6] => :are
[7] => supported
[8] => by
[9] => this
[10] => server
)
:irc.foonet.com 005 ellis-bot2 WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQK
Array
(
[0] => :irc.foonet.com
[1] => 005
[2] => ellis-bot2
[3] => WATCH=128
[4] => SILENCE=15
[5] => MODES=12
[6] => CHANTYPES=#
[7] => PREFIX=(qaohv)~&@%+
[8] => CHANMODES=beI,kfL,lj,psmntirRcOAQK
)
VCuzNSMTG NETWORK=ROXnet CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=~&@%+ EXCEPTS INVEX :are supported by this serve
Array
(
[0] => VCuzNSMTG
[1] => NETWORK=ROXnet
[2] => CASEMAPPING=ascii
[3] => EXTBAN=~,cqnr
[4] => ELIST=MNUCT
[5] => STATUSMSG=~&@%+
[6] => EXCEPTS
[7] => INVEX
[8] => :are
[9] => supported
[10] => by
[11] => this
[12] => serve
)
r
Array
(
[0] => r
)
:irc.foonet.com 005 ellis-bot2 CMDS=KNOCK,MAP,DCCALLOW,USERIP :are supported by this server
Array
(
[0] => :irc.foonet.com
[1] => 005
[2] => ellis-bot2
[3] => CMDS=KNOCK,MAP,DCCALLOW,USERIP
[4] => :are
[5] => supported
[6] => by
[7] => this
[8] => server
)
:irc.foonet.com 251 ellis-bot2 :There are 1 users and 0 invisible on 1 servers
Array
(
[0] => :irc.foonet.com
[1] => 251
[/code]
and here is the[size=2] code[/size]
[code]<?php
// No execution Time limit
set_time_limit(0);
// Opening the socket to the Rizon network
$socket = fsockopen(“127.0.0.1”, 6667) or die(‘Could not connect to the server’);
// Send auth info
$nick = ‘ellis-bot2’;
fputs($socket,“USER CMbot combined-minds.net CM :CM botn”);
fputs($socket,“NICK $nickn”);
// Join a channel
fputs($socket,“JOIN #wesn”);
// 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 ‘
’;’;
print_r($ex);
echo ‘
}
usleep(100000);
}
?> [/code]
i need someone to change this code so it will work and post it on here please.
MOD EDIT: Added code tags