3

このコードを使用してワードプレスにデータを投稿しようとしていますが、トークンがnullになっています

sXmlRpcURLの代わりにhttp://wordpress.com/http://sUsername.wordpress.com/も使用しましたが、どちらの場合も生成トークンはnullです。

    String sXmlRpcURL= arg[0];
    String sUsername = arg[1];
    String sPassword = arg[2];

    // Hard-coded blog_ID
    int blog_ID = 1;

    // XML-RPC method
    String sXmlRpcMethod = "blogger.newPost";
    // XML-RPC method ver 2                      

// sXmlRpcMethod = "metaWeblog.newPost"; //これも使用しました

    // We'll hard-code our blog content for now as well
    String sTitle = "HI........";
    String sContent = "Hello XML-RPC World!";

    // Create our content struct
    HashMap hmContent = new HashMap();
    hmContent.put("title", sTitle);
    hmContent.put("description", sContent);

    // You can specify whether or not you want the blog published immediately
    boolean bPublish = true;

    // Try block
    try {
        // Create the XML-RPC client
        XmlRpcClient client = new XmlRpcClient(sXmlRpcURL,true);

        // Make our method call
        Object token = client.invoke( sXmlRpcMethod, new Object[] { new Integer( blog_ID ), sUsername, sPassword, hmContent, new Boolean( bPublish ) } );

        // The return is a String containing the postID
        System.out.println("Posted : " + (String) token);
    } // Catch exceptions
    catch (Exception e) {
    }

私を助けてください。

4

1 に答える 1

1

私はあなたが使いたい解決策を持っています-

http://sUsername.wordpress.com/xmlrpc.php

sXmlRpcURLの場合。今それはうまく機能しています-

于 2011-05-06T08:28:33.710 に答える