WordPress has two testing methods on its XML-RPC server:
demo.sayHello – Returns a standard "Hello!" message. demo.addTwoNumbers – Accepts an array containing two numbers and returns the sum. function sayHello() { $params = array(); return $this->send_request('demo.sayHello',$params); } $objXMLRPClientWordPress = new XMLRPClientWordPress("http://localhost/wordpress31/xmlrpc.php" , "username" , "passowrd"); function send_request($requestname, $params) { $request = xmlrpc_encode_request($requestname, $params); $ch = curl_init(); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_URL, $this->XMLRPCURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 1); $results = curl_exec($ch); curl_close($ch); return $results; }
If you get the same result, it means that you can correctly send the request to your WordPress XML-RPC server and correctly receive the request.
Subodh ghulaxe
source share