ejabberd - Comments for "XMLRPC Error"
https://www.ejabberd.im/node/4504
enTry this script
https://www.ejabberd.im/node/4504#comment-57008
<div class="quote-msg">
<div class="quote-author"><em>ashansky</em> wrote:</div>
<p>Where does the /RPC2 come from?
</p></div>
<p>Maybe from the erlang xmlrpc library.</p>
<div class="quote-msg">
<div class="quote-author"><em>ashansky</em> wrote:</div>
<p>PHP Warning: file_get_contents(<noindex><a href="http://127.0.0.1:4560/RPC2" title="http://127.0.0.1:4560/RPC2" rel="nofollow" >http://127.0.0.1:4560/RPC2</a></noindex>): failed to open stream: HTTP request failed! </p>
<p>I've checked to make sure that ejabberd is listening on that port.
</p></div>
<p>You should get something like this:</p>
<pre>
$ netstat -pnl | grep 4560
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:4560 0.0.0.0:* LISTEN 29644/beam.smp
</pre><pre>
$ telnet 127.0.0.1 4560
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
hello
HTTP/1.1 400 Bad Request
Content-Length: 0
Server: Erlang/1.13
Content-Type: text/xml
</pre><div class="quote-msg">
<div class="quote-author"><em>ashansky</em> wrote:</div>
<p>Is there something else I need to setup?
</p></div>
<p>I found this PHP script file:</p>
<pre>
<?
$param=array("host"=>"localhost");
$request = xmlrpc_encode_request('registered_users', $param, (array('encoding' => 'utf-8')));
$context = stream_context_create(array('http' => array(
'method' => "POST",
'header' => "User-Agent: XMLRPC::Client mod_xmlrpc\r\n" .
"Content-Type: text/xml\r\n" .
"Content-Length: ".strlen($request),
'content' => $request
)));
$file = file_get_contents("http://127.0.0.1:4560/RPC2", false, $context);
$response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) {
trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
print_r($response);
}
?>
</pre><p>
I have two account registered. When i run that script, I get this:</p>
<pre>
$ php 4504-registered-works.php
Array
(
[users] => Array
(
[0] => Array
(
[username] => badlop
)
[1] => Array
(
[username] => badlop2
)
)
)
</pre>Fri, 28 Jan 2011 10:23:20 +0000mfosscomment 57008 at https://www.ejabberd.imI've made sure that ejabberd
https://www.ejabberd.im/node/4504#comment-56994
<p>I've made sure that ejabberd is listening on port 4560, but I receive this error whenever I try to run a command.</p>
<p>PHP Warning: file_get_contents(<noindex><a href="http://127.0.0.1:4560/RPC2" title="http://127.0.0.1:4560/RPC2" rel="nofollow" >http://127.0.0.1:4560/RPC2</a></noindex>): failed to open stream: HTTP request</p>
<p>Code</p>
<div class="codeblock"><code> protected /*string*/ function sendRequest(/*string*/$command,/*array*/$params){<br /> //check that params is array if not create<br /> if(!is_array($params)){<br /> $params = array();<br /> }<br /> //$params["user"] = "admin";<br /> //$params["host"] = "localhost";
<p> $request = xmlrpc_encode_request($command, $params, (array('encoding' => 'utf-8')));</p>
<p> $context = stream_context_create(array('http' => array(<br /> 'method' => "POST",<br /> 'header' => "User-Agent: XMLRPC::Client mod_xmlrpc\r\n" .<br /> "Content-Type: text/xml\r\n" .<br /> "Content-Length: ".strlen($request),<br /> 'content' => $request<br /> )));</p>
<p> $file = file_get_contents("http://127.0.0.1:4560/RPC2", false, $context);</p>
<p> $response = xmlrpc_decode($file);</p>
<p> if (xmlrpc_is_fault($response)) {<br /> trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");<br /> } else {<br /> return $response;<br /> } <br /> }</p></code></div>
Thu, 20 Jan 2011 15:26:51 +0000ashanskycomment 56994 at https://www.ejabberd.imSeems like now I've run up
https://www.ejabberd.im/node/4504#comment-56990
<p>Seems like now I've run up against another error: </p>
<p>PHP Warning: file_get_contents(<noindex><a href="http://127.0.0.1:4560/RPC2" title="http://127.0.0.1:4560/RPC2" rel="nofollow" >http://127.0.0.1:4560/RPC2</a></noindex>): failed to open stream: HTTP request failed! </p>
<p>I've checked to make sure that ejabberd is listening on that port. Is there something else I need to setup? Where does the /RPC2 come from?</p>
Wed, 19 Jan 2011 23:15:21 +0000ashanskycomment 56990 at https://www.ejabberd.imI found the compiled files
https://www.ejabberd.im/node/4504#comment-56988
<p>I found the compiled files for the xmerl patch and placed them in ejabberd-x.x.x\lib\kernel-x.x.x\ebin and ejabberd started up normally. Now to see if it works :)</p>
Wed, 19 Jan 2011 17:28:22 +0000ashanskycomment 56988 at https://www.ejabberd.im