Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: XMLRPC module does not return any results!  (Read 1827 times)

0 Members and 1 Guest are viewing this topic.

Gabriel Guilherme

  • Anope User
  • Offline Offline
  • Posts: 2
XMLRPC module does not return any results!
« on: January 15, 2016, 09:42:49 AM »

XMLRPC module does not return any results..

Modules loaded:
Code: [Select]
07:39:16; -OperServ- Current module list:
07:39:16; -OperServ- Module: unreal [2.0.2] [Protocol, Vendor]
07:39:16; -OperServ- Module: db_flatfile [2.0.2] [Database, Vendor]
07:39:16; -OperServ- Module: enc_none [2.0.2] [Encryption, Vendor]
07:39:16; -OperServ- Module: m_httpd [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: m_mysql [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: m_sql_log [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: webcpanel [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: m_chanstats [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: irc2sql [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: m_xmlrpc [2.0.2] [Extra, Vendor]
07:39:17; -OperServ- Module: m_xmlrpc_main [2.0.2] [Extra, Vendor]

My PHP:

Code: [Select]
<?php
/* XMLRPC Functions
 *
 * (C) 2003-2014 Anope Team
 * Contact us at team@anope.org
 *
 */

class AnopeXMLRPC
{
private $Host;

function __construct($Host)
{
$this->Host $Host;
}

/** Run an XMLRPC command. Name should be a query name and params an array of parameters, eg:
 * $this->RunXMLRPC("checkAuthentication", array("adam", "qwerty"));
 * If successful returns back an array of useful information.
 *
 * Note that $params["id"] is reserved for query ID, you may set it to something if you wish.
 * If you do, the same ID will be passed back with the reply from Anope.
 */
function RunXMLRPC($name$params)
{
$xmlquery xmlrpc_encode_request($name$params);
$context stream_context_create(array("http" => array(
"method" => "POST",
"header" => "Content-Type: text/xml",
"content" => $xmlquery)));

$inbuf file_get_contents($this->Hostfalse$context);
$response xmlrpc_decode($inbuf);

if (isset($response[0]))
return $response[0];
return NULL;
}

/** Do Command on Service as User, eg:
 * $anope->DoCommand("ChanServ", "Adam", "REGISTER #adam");
 * Returns an array of information regarding the command execution, if
 * If 'online' is set to yes, then the reply to the command was sent to the user on IRC.
 * If 'online' is set to no, then the reply to the command is in the array member 'return'
 */
function DoCommand($Service$User$Command)
{
return $this->RunXMLRPC("command", array($Service$User$Command));
}

/** Check an account/nick name and password to see if they are valid
 * Returns the account display name if valid
 */
function CheckAuthentication($Account$Pass)
{
$ret $this->RunXMLRPC("checkAuthentication", array($Account$Pass));

if ($ret && $ret["result"] == "Success")
return $ret["account"];
return NULL;
}

/* Returns an array of misc stats regarding Anope
 */
function DoStats()
{
return $this->RunXMLRPC("stats"NULL);
}

/* Look up data for a channel
 * Returns an array containing channel information, or an array of size one
 * (just containing the name) if the channel does not exist
 */
function DoChannel($Channel)
{
return $this->RunXMLRPC("channel", array($Channel));
}

/* Like DoChannel(), but different.
 */
function DoUser($User)
{
return $this->RunXMLRPC("user", array($User));
}
}

$anopexmlrpc = new AnopeXMLRPC("http://SERVICESIP:8080/xmlrpc");
print_r($anopexmlrpc->DoChannel("#OsNet"));


?>


I hid the ip of mine for security services and if necessary I post ...
Logged

Gabriel Guilherme

  • Anope User
  • Offline Offline
  • Posts: 2
Re: XMLRPC module does not return any results!
« Reply #1 on: January 15, 2016, 09:57:09 AM »

Logged
Pages: [1]   Go Up