The problem with the simple XML-RPC wordpress solution was that it did not have feedback whether the post was successful. I knew I could get the response from curl_exec, but I have to figure out the XPath part. Similarly I was hoping for some ready-made function to do that, but it seems things were not so straightforward. Furthermore, being on PHP4 means I didn’t have the luxury of the newer XML functions such as SimpleXML.
After some fiddling, this was the simplest I could go:
$dom = domxml_open_mem($response); $faultString = xpath_eval(xpath_new_context($dom), "/methodResponse/fault/value/struct/member[name='faultString']/value/string/text()"); return $faultString->nodeset->content;
The XPath expression was also a level-up: I had to select a node based on the child data of its sibling.