Re: IRC from PHP - help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You might want to go to http://www.hotscripts.com and search for irc in the php category.

Steve

At 08:47 AM 4/1/2005, Matthew Fonda wrote:

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

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux