1

I am using HTTPie to do a POST request to my local Wordpress installation with the aim of checking if XML-RPC is available and enabled.

http --verify=no POST https://crmpicco.localhost/xmlrpc.php data="<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>wp.getUsersBlogs</methodName><params><param><value>admin</value></param><param><value>pass</value></param></params></methodCall>"

This returns a 200, however the response has a faultCode:

HTTP/1.1 200 OK
Connection: close
Content-Length: 403
Content-Type: text/xml; charset=UTF-8
Date: Fri, 08 Mar 2019 03:18:43 GMT
Server: Apache/2.4.35 (Unix) OpenSSL/1.0.2p PHP/7.2.11
X-Powered-By: PHP/7.2.11

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value><int>-32700</int></value>
        </member>
        <member>
          <name>faultString</name>
          <value><string>parse error. not well formed</string></value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>

Others with this issue point to having the php-xml extension unavailable, however when I do a php -m | grep -i xml it is showing as installed:

libxml
SimpleXML
xml
xmlreader
xmlrpc
xmlwriter

What am I missing?

hakre
  • 193,403
  • 52
  • 435
  • 836
crmpicco
  • 16,605
  • 26
  • 134
  • 210

2 Answers2

1

I had to fallback to using cURL for this. I'm unsure as to what exactly I was doing wrong with HTTPie or if it has a limitation in this regard, however it worked with cURL with:

curl -k -d '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>wp.getUsersBlogs</methodName><params><param><value>user</value></param><param><value>pass</value></param></params></methodCall>' https://crmpicco.localhost/xmlrpc.php

crmpicco
  • 16,605
  • 26
  • 134
  • 210
1

I have same issue, the calling to wordpress API works with phpxmlrpc-4.0.0, but having some warnings about deprecated functions, so I upgraded to phpxmlrpc-4.4.1, then got this "parse error. not well formed" error

UPDATE: I just found out the workaround for it: In file "lib/xmlrpc.inc", change encoding setting:

From:

PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'ISO-8859-1';

To:

PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';

Another node is that: seting

$xml_rpc_client->request_charset_encoding="UTF-8"

just makes my text content messed up

Ben
  • 379
  • 1
  • 5
  • 14
  • You do not need to change the code within the phpxmlrpc library itself. You can set `PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';` anywhere in your own app's code – gggeek Dec 22 '22 at 10:39