Skip to content

Instantly share code, notes, and snippets.

@fabriziomachado
Created December 7, 2011 16:01
Show Gist options
  • Save fabriziomachado/1443327 to your computer and use it in GitHub Desktop.
Save fabriziomachado/1443327 to your computer and use it in GitHub Desktop.
application/workers/notifier.php
<?php #if (!defined('BASEPATH')) { exit('No direct script access allowed'); }
class Notifier {
private $CI;
public function __construct()
{
$this->CI =& get_instance();
$this->CI->load->spark('restclient/2.0.0');
$this->CI->load->library('rest');
$this->url_server = 'http://localhost:8000/';
}
public function publish($channel, $message)
{
$this->CI->rest->initialize(array('server' => 'http://localhost:8000/',
'http_user' => 'admin',
'http_pass' => 'secret',
'http_auth' => 'basic'));
$this->CI->rest->post($channel , array('title' => 'NOTICE', 'message'=> $message), 'json');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment