/** * @param $action * @param null $args */ function modules_api($action, $args = null) { if (is_array($args)) { $args = (object) $args; } $url = $http_url = 'http://api.hoangweb.com/modules/info/1.0/'; if ($action == 'module_information') { return HW_XMLRPC_API::current()->modules_info($args->slug); } }
//for testing function hello_world($params) { # global $wp_xmlrpc_server; $arg1 = $params; return "Hello " . $wp_xmlrpc_server->escape($arg1); } //test simple rpc client public function test_client() { $client = new HW_XMLRPC_Client("http://localhost/wordpress/xmlrpc.php"); $available_methods = $client->call('system.listMethods'); print_r($available_methods); } //test rpc client with xmlrpcmsg function test_phpxmlrpc() { $r = $this->call('hw.core.module_info', 'api'); if (!$r->faultCode()) { $v = $r->value(); __print(htmlentities($v->scalarval())); #__print (htmlentities($r->serialize()) ); } else { print "Fault <BR>"; print "Code: " . htmlentities($r->faultCode()) . "<BR>" . "Reason: '" . htmlentities($r->faultString()) . "'<BR>"; } } } HW_XMLRPC_API::register();