Skip to content

Instantly share code, notes, and snippets.

@Zoddo
Last active August 29, 2015 14:19
Show Gist options
  • Save Zoddo/f8043a1c957157188dbe to your computer and use it in GitHub Desktop.
Save Zoddo/f8043a1c957157188dbe to your computer and use it in GitHub Desktop.
A simple exemple for https://github.com/Zoddo/php-irc
<?php
include 'vendor/autoload.php';
$config = new \Zoddo\irc\Config('irc.ekinetirc.fr.nf', 'TestPhpIrc');
//$config->setPort(6697)
// ->setSsl();
$connection = new \Zoddo\irc\IrcConnection($config);
$connection->getEvent()->addListener('ping', array(new \Zoddo\irc\EventListener\PingResponder(), 'onPing'));
$connection->connect();
while(!$connection->feof())
{
$data = $connection->irc_read();
if ($data === false)
{
continue;
}
$connection->callListeners($data);
if ($data['command'] == '001')
{
$connection->join('#Zoddo')
->privmsg('#Zoddo', 'Test1')
->privmsg('#Zoddo', 'Test2')
->privmsg('#Zoddo', 'Test3')
->part('#Zoddo')
->quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment