You are here: Re: [PHP] IRC from PHP - help « PHP « IT news, forums, messages
Re: [PHP] IRC from PHP - help

Posted by Matthew Fonda on 10/23/72 11:12

You might want to check out PEAR::Net_SmartIRC
http://pear.php.net/package/Net_SmartIRC

> hello
>
> i'm a newcomer to this list, fairly experienced PHP programmer but coding
> mostly for personal web sites or hobbies. I also run an irc chat network
> and am curious as to if I can integrate php into it somehow. for example:
>
> I want to have a webpage that can present a list of all connected users to
> my irc network, or maybe a webpage to facilitate nickname
> registration/activation. my idea is to somehow connect a
> randomly-nicknamed client to the server like "PHP-19942333" or something,
> which would execute the commands. I fully understand the irc protocol and
> have written a working irc client in VB.
>
> i don't have experience enough to know if PHP has some sort of "event"
> mechanism, for example, to be like on ircNamesList($names) { echo
> $names['1']; } or something. (pseudo-code)
>
> does anyone have an idea as to how this stuff could be done?
>
> Here's a sort of pseudo-code of what I'd want, PHP-style but obviously
> most of the functions are fake.
>
> // Begin pseudo-code.
> <?php
>
> echo "Activating nickname...";
>
> $php_nickname = "PHPInterface" // or have it generate a random number
> irc_connect(192.168.1.1,6667,$php_nickname)
>
> $nick_command = "REGISTER $_GET['nick'] $_GET['email'] $_GET['pass']";
> irc_send_privmsg("NickServ",$nick_command);
>
> // some way to hold processing until the response is received...
> wait_for_response();
> // or maybe a while loop, like while $success = "false"...
>
> // after response, die
> exit("Finished");
>
> // parse response
> on event irc_privmsg($nick,$msg) {
> if ($nick == "NickServ") {
> if ($msg == "Your nickname has been successfully registered.") {
> echo "Registration succeeded!";
> }
> elseif ($msg == "Invalid syntax") {
> echo "Error.";
> }
> irc_quit("PHP Script finished.");
> }
> ?>
>
> obviously I'd also have to dress that page up a lot more, adding HTML code
> and such.
>
> This would also need a lot of error-trapping. Like if IRC couldn't connect
> for whatever reason, or if NickServ wasn't available, or who knows what.
>
> Well that's basically what I'm after. IDEAS??..
>
> Flint
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация