2012-02-28 43 views

回答

1

您应该使用WordPress的插件,多地点。你here只是不得不做出一个方法调用创建新博客与下multi-site.Here新的路径是使用Apache XML-RPC API的例子

public class Demo 
{ 
    public static void main(String[] args) 
    { 
    System.out.println("Starting adicXmlRpcServer test"); 

    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 
    try 
    { 
     config.setServerURL(new URL("http://localhost/wordpress/xmlrpc.php")); 
    } 
    catch (MalformedURLException ex) 
    { 
     System.out.println("Invalid url....."+ex.getMessage()); 
     ex.printStackTrace(); 
    } 

    XmlRpcClient client = new XmlRpcClient(); 
    client.setConfig(config); 
    Map map = new HashMap(); 
    map.put("domain","localhost"); 
    map.put("path","/newStrore"); 
    map.put("title","newStrore"); 
    map.put("user_id","[email protected]"); 

    Object[] params = new Object[] {new String("admin"),new String("9868"),map}; 

    try 
    { 
     Object result = (Object) client.execute("ms.CreateBlog",params); 
     ArrayList<String> dirListing = new ArrayList<String>(); 
     System.out.println(result.toString()); 
    } 
    catch (XmlRpcException ex) 
    { 
     System.out.println("Invalid url....."+ex.getMessage()); 
     ex.printStackTrace(); 
    } 
    } 
} 
相关问题