どうやってプログラムでブログに文章を書き込むか?

2812 ワード

テストをするためにネットで探して記録を作りました。
まず、javaプログラムを使います。コードは私のところではなく、ソースを書きます。http://www.vipcn.com/wangluobiancheng/XMLSoap/337183_6.
まず、いくつかのjarカバンが必要です。
http://mirror.bit.edu.cn/apache/ws/xmlrpc/
ダウンロード
apache-xmlrpc-current-bin.zip 
      jar     。
 
 
package blog;

import java.util.*;
import java.io.*;
import java.net.URL;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

public class blog{
	public static void main(String[] args) throws Exception{
// Set up XML-RPC connection to server 
	XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
	config.setServerURL(new URL("http://os.blog.163.com/api/xmlrpc/metaweblog/"));//url      API  
	XmlRpcClient client = new XmlRpcClient();
	client.setConfig(config);
// Set up parameters required by newPost method 
	Map<String, String> post = new HashMap<String,String>();
	post.put("title", "  ");
	post.put("link","http://www.vonhagen.org/");
	post.put("description", "    ");
	Object[] params = new Object[]{"2", "   ", "  ", post, Boolean.TRUE};
// Call newPost 
	String result = (String) client.execute("metaWeblog.newPost",params);
	System.out.println(" Created with blogid " + result);
	}
}
  ,      jar      。    。                     。
    API:
    :http://os.blog.163.com/api/xmlrpc/metaweblog/
   :http://www.cnblogs.com/<     >/services/metaweblog.aspx
  zBlog:http://your.zblog.site/xml-rpc/index.asp
  Wordpress   http://      /xmlrpc.php
CSDN:http://blog.csdn.net/<     >/services/metablogapi.aspx(        )