No I didn't PHP was quite difficult in working with IRC. I found the solution that worked best for me was to program a Bot that would put the info I needed into files. My PHP scripts then accessed the files.
php IRC script
Not as far as I know... I haven't touched IRC since then
Sorry
Glad to hear you got it going, sorry I wasn't more help
After lots of time and reading of other peoples attempts on phpbuilder i managed to get it to work.
If you are still interested :
<?php
include("../phpIRC.inc.php3");
include("../phpIRC.php3");
$wanted_server = "ENTER IRC SERVER HERE"; // server we want to connect to
$wanted_port = 6667; // port on server to connect to
$nick="NICKNAME HERE"; // our nickname
if(!irc_init())
die("Initialization error.<br>"); // join server
irc_change_nick($nick); // and
if(!irc_connect($wanted_server, $wanted_port))
die("Connection error.<br>"); // set nick names etc
global $channel_name,$trignick,$nick,$nick_list;
$channel_name="#CHANNEL HERE"; // channel to join
irc_join($channel_name); // join the channel
irc_set_debug_mode(1); // debug set 1 to 0 for off
irc_add_callback(IRCRPL_NAMREPLY, "showseen"); // add callback for nicklist found
irc_idle(IRCRPL_NAMREPLY); // loop until nicklist info found
irc_disconnect("bye"); // quit
echo $string; // output the string to the browser
function showseen($code, $nick, $identd, $host, $destination, $text)
{
global $channel_name,$nick,$string;
$nicklist = irc_get_nick_list($channel_name); // get nicklist
$string="People in the IRC channel are :-"; // set string start
while (list($key, $ircnick) = each($nicklist)) { // get list of nicks
if (!($ircnick == $nick)) { // missing out our own nick
$string = $string ." ". $ircnick.","; // and add them to the variable $string
}
}
}
?>
Thanks Ian, I'll squirrel that one away somewhere...
The thing that made me not persue what you wrote was the amount of visitors I had comming to my site. You get so many accesses that it just gets to be to much. I was trying to have my users always see on the front page of my site who was on my IRC channel.I would have so many connections going to the server . Not to mention all the folks that sat on my site constantly hitting refresh to see if their friends were on IRC.
What about caching the results? you could write them out to a txt file or bung them in a database, and only update them if they were more than say 5 minutes old... or is the end result not worth the hassle?
What I needed was real time results. With the bot method it is pretty much instantaneous. I can also do other cool stuff like have the last 500 K of chat transcript streaming onto my site.
Would be interested in more info on your solution Sol, Where would i find out how to do this kinda thing.
I agree having a a person pop in and out every 15mins is very annoying!
Erm.. What are the included files? Because you didn't mengioned them. It maybe includes the IRC functions or so ?
They are part of the PHP IRC package put together by phpwizard.net, as mentioned elsewhere in the thread.
First off, thanks for this thread and the link to the IRC functions. The ircg functions listed at php.net weren't very useful for what I needed to do.
I also wanted to let anybody know that I'm working on a different solution to this problem, by coding an entire bot in PHP and having it run as a stand-alone PHP program, rather than as a web page. If all goes well, it will be able to store information such as current people in the channel, and recent logs in MySQL, which can then be accessed from another script available to the web. That way the bot doesn't keep popping in and out, but the web server just keeps popping into its database.
I'll keep you all posted on my progress.
-Gul
Surely that would require the script to be run as a daemon process which the majority of hosts as standard do / would not allow.
Is that correct?
However will still be interested to see the finished result.