ejabberd - Comments for "XMLRPC Error" https://www.ejabberd.im/node/4504 en Try 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> &lt;? $param=array("host"=&gt;"localhost"); $request = xmlrpc_encode_request('registered_users', $param, (array('encoding' =&gt; 'utf-8'))); $context = stream_context_create(array('http' =&gt; array( 'method' =&gt; "POST", 'header' =&gt; "User-Agent: XMLRPC::Client mod_xmlrpc\r\n" . "Content-Type: text/xml\r\n" . "Content-Length: ".strlen($request), 'content' =&gt; $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); } ?&gt; </pre><p> I have two account registered. When i run that script, I get this:</p> <pre> $ php 4504-registered-works.php Array ( [users] =&gt; Array ( [0] =&gt; Array ( [username] =&gt; badlop ) [1] =&gt; Array ( [username] =&gt; badlop2 ) ) ) </pre> Fri, 28 Jan 2011 10:23:20 +0000 mfoss comment 57008 at https://www.ejabberd.im I'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[&quot;user&quot;] = &quot;admin&quot;;<br /> //$params[&quot;host&quot;] = &quot;localhost&quot;; <p> $request = xmlrpc_encode_request($command, $params, (array(&#039;encoding&#039; =&gt; &#039;utf-8&#039;)));</p> <p> $context = stream_context_create(array(&#039;http&#039; =&gt; array(<br /> &#039;method&#039; =&gt; &quot;POST&quot;,<br /> &#039;header&#039; =&gt; &quot;User-Agent: XMLRPC::Client mod_xmlrpc\r\n&quot; .<br /> &quot;Content-Type: text/xml\r\n&quot; .<br /> &quot;Content-Length: &quot;.strlen($request),<br /> &#039;content&#039; =&gt; $request<br /> )));</p> <p> $file = file_get_contents(&quot;http://127.0.0.1:4560/RPC2&quot;, false, $context);</p> <p> $response = xmlrpc_decode($file);</p> <p> if (xmlrpc_is_fault($response)) {<br /> trigger_error(&quot;xmlrpc: $response[faultString] ($response[faultCode])&quot;);<br /> } else {<br /> return $response;<br /> } <br /> }</p></code></div> Thu, 20 Jan 2011 15:26:51 +0000 ashansky comment 56994 at https://www.ejabberd.im Seems 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 +0000 ashansky comment 56990 at https://www.ejabberd.im I 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 +0000 ashansky comment 56988 at https://www.ejabberd.im