diff options
author | Adam <Adam@anope.org> | 2012-11-03 22:04:19 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-03 22:04:19 -0400 |
commit | fb56b3a53f0dc54cc36af5c9caf189bb71a3d5e9 (patch) | |
tree | 8b6f52f844d5f9d93e072d4e5b8527f6d2c04fc7 /docs/XMLRPC | |
parent | 0c4701704689f0452cdaa540d744c231c48f3aa8 (diff) |
Made m_xmlrpc use m_httpd
Diffstat (limited to 'docs/XMLRPC')
-rw-r--r-- | docs/XMLRPC/xmlrpc.php | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/docs/XMLRPC/xmlrpc.php b/docs/XMLRPC/xmlrpc.php index 82cc4fa78..199289926 100644 --- a/docs/XMLRPC/xmlrpc.php +++ b/docs/XMLRPC/xmlrpc.php @@ -8,26 +8,11 @@ class AnopeXMLRPC { - private $Host, $Bind, $Port; + private $Host; - private $Socket; - - function __construct($Host, $Port, $Bind = NULL) + function __construct($Host) { $this->Host = $Host; - $this->Port = $Port; - $this->Bind = $Bind; - - $this->Socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - if ($Bind && socket_bind($this->Socket, $this->Bind) == false) - $his->Socket = false; - if (socket_connect($this->Socket, $this->Host, $this->Port) == false) - $this->Socket = false; - } - - function __destruct() - { - @socket_close($this->Socket); } /** Run an XMLRPC command. Name should be a query name and params an array of parameters, eg: @@ -40,10 +25,12 @@ class AnopeXMLRPC function RunXMLRPC($name, $params) { $xmlquery = xmlrpc_encode_request($name, $params); - socket_write($this->Socket, $xmlquery); + $context = stream_context_create(array("http" => array( + "method" => "POST", + "header" => "Content-Type: text/xml", + "content" => $xmlquery))); - $inbuf = socket_read($this->Socket, 4096); - $inbuf = substr($inbuf, strpos($inbuf, "\r\n\r\n") + 4); + $inbuf = file_get_contents($this->Host, false, $context); $response = xmlrpc_decode($inbuf); if (isset($response[0])) @@ -98,4 +85,6 @@ class AnopeXMLRPC } } +$anopexmlrpc = new AnopeXMLRPC("http://127.0.0.1:8080/xmlrpc"); + ?> |