XMLRPCã§ã«ãã´ãªã¨ã¿ã°ä»ãã§ããã°è¨äºãæ稿ããæ¹æ³
ããã°ã«è¨äºãæ稿ããã®ã«ãã«ãã´ãªã¨ã¿ã°ãæå®ãã¦æ稿ãããã¨ãããã ãã©ããªããªããã¾ããããªãã¦è©¦è¡é¯èª¤ãã¦ããã£ã¨ãã¾ããã£ãã®ã§ã¾ã¨ãã¨ãã
ã«ãã´ãªã¨ã¿ã°ãStringé åã«ãã¦Mapã«æ ¼ç´ããã®ããã¤ã³ãã ã£ããããã
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); String url = "http://memo.satoshis.jp/xmlrpc.php"; config.setServerURL(new URL(url)); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Hashtable<Object,Object> hash = new Hashtable<>(); hash.put("post_title", title);// è¨äºã®ã¿ã¤ãã« hash.put("post_content", contents);// æ¬æ hash.put("post_author", "1"); // hash.put("post_status", "publish"); // ä¸è¬å ¬é Map<String, Object> terms = new HashMap<>(); terms.put("category", categories); // ã«ãã´ãªãStringé å㧠terms.put("post_tag", tags); // ã¿ã°ãStringé å㧠hash.put("terms_names", terms); Object[] params = new Object[5]; params[0] = "1"; // BlogID params[1] = "userid"; params[2] = "password"; params[3] = hash; params[4] = true; Object result = client.execute("wp.newPost", params);