Site Search
Homepage of Otaku No Zoku
Complete Archives of Otaku No Zoku
About Otaku No Zoku
Subscribe to Otaku No Zoku
Bookmark Otaku No Zoku

Using curl to debug WordPress XMLRPC calls :

Need a quick and dirty way to see what results WordPress XMLRPC calls are returning from the server?

Try curl, the Swiss army knife of command-line network tools.

The CURL Command

For Windows:

curl -d "<?xml version=\"1.0\"?> <methodCall> <methodName>wp.getUsersBlogs</methodName> <params> <param> <value>username</value> </param> <param> <value>password</value> </param> </params> </methodCall>" http://otakunozoku.com/xmlrpc.php

For Linux:

curl -d '<?xml version="1.0"?> <methodCall> <methodName>wp.getUsersBlogs</methodName> <params> <param> <value>username</value> </param> <param> <value>password</value> </param> </params> </methodCall>' http://otakunozoku.com/xmlrpc.php

Just change the domain name from otakunozoku.com to the one you use, along with the username and password for accessing your WordPress blog.

When you execute that command, you should see output similar to the following:

WordPress XMLRPC Output

<?xml version="1.0"?>
<methodresponse>
 <params>
  <param>
  <value>
   <array>
    <data>
     <value>
      <struct>
       <member>
        <name>isAdmin</name>
        <value>
         <boolean>1</boolean>
        </value>
       </member>
       <member>
        <name>url</name>
        <value>
         <string>http://www.otakunozoku.com/</string>
        </value>
       </member>
       <member>
        <name>blogid</name>
        <value>
         <string>1</string>
        </value>
       </member>
       <member>
        <name>blogName</name>
         <value>
          <string>Otaku No Zoku</string>
         </value>
        </member>
        <member>
         <name>xmlrpc</name>
         <value>
          <string>http://www.otakunozoku.com/xmlrpc.php</string>
         </value>
        </member>
       </struct>
      </value>
     </data>
    </array>
   </value>
  </param>
 </params>
</methodresponse>

Which is useful when you just need to see what the server is sending back to you. The WordPress Codex has a list of all XMLRPC methods you can call. Just watch out for your capilization of XML tags, WordPress is unforgiving

Liked This Post?

Subscribe to the RSS feed or follow me on Twitter to stay up to date!