Net_SmartIRC
[ class tree: Net_SmartIRC ] [ index: Net_SmartIRC ] [ all elements ]

Source for file example2.php

Documentation is available at example2.php

  1. s<?php
  2. /**
  3.  * $Id: example2.php,v 1.3.2.1 2004/12/20 15:54:51 meebey Exp $
  4.  * $Revision: 1.3.2.1 $
  5.  * $Author: meebey $
  6.  * $Date: 2004/12/20 15:54:51 $
  7.  *
  8.  * Copyright (c) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net>
  9.  * 
  10.  * Full LGPL License: <http://www.meebey.net/lgpl.txt>
  11.  * 
  12.  * This library is free software; you can redistribute it and/or
  13.  * modify it under the terms of the GNU Lesser General Public
  14.  * License as published by the Free Software Foundation; either
  15.  * version 2.1 of the License, or (at your option) any later version.
  16.  *
  17.  * This library is distributed in the hope that it will be useful,
  18.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.  * Lesser General Public License for more details.
  21.  *
  22.  * You should have received a copy of the GNU Lesser General Public
  23.  * License along with this library; if not, write to the Free Software
  24.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25.  */
  26. // ---EXAMPLE OF HOW TO USE Net_SmartIRC---
  27. // this code shows how you could show on your homepage how many users are in a specific channel
  28. include_once('Net/SmartIRC.php');
  29.  
  30. $irc &new Net_SmartIRC();
  31. $irc->startBenchmark();
  32. $irc->setDebug(SMARTIRC_DEBUG_ALL);
  33. $irc->setUseSockets(TRUE);
  34. $irc->setBenchmark(TRUE);
  35. $irc->connect('irc.freenet.de'6667);
  36. $irc->login('Net_SmartIRC''Net_SmartIRC Client '.SMARTIRC_VERSION.' (example2.php)'0'Net_SmartIRC');
  37. $irc->getList('#php');
  38. // BUG! (see: http://pear.php.net/bugs/bug.php?id=2309)
  39. // can't fix listenFor() because of backwards compatibity issues, it needs to return an array of ircdata objects
  40. // instead of just ircdata->message array
  41. // So we use objListenFor() here, which is available in >= 0.5.6
  42. //$resultar = $irc->listenFor(SMARTIRC_TYPE_LIST);
  43. $resultar $irc->objListenFor(SMARTIRC_TYPE_LIST);
  44. $irc->disconnect();
  45. $irc->stopBenchmark();
  46.  
  47. if (is_array($resultar)) {
  48.     $count $resultar[0]->rawmessageex[4];
  49.     ?>
  50.         <B>On the #php IRC Channel are <? echo $count; ?> Users</B>
  51.     <?php
  52. else {
  53.     ?>
  54.         <B>An error occured, please check the specified server and settings<B>
  55.     <?php
  56. }
  57. ?>

Documentation generated on Mon, 11 Mar 2019 14:19:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.