I am trying to send data to wordpress using this code, but I get a null token
Instead of sXmlRpcURL I used http://wordpress.com/ and http://sUsername.wordpress.com/ , but both cases generate a null token.
String sXmlRpcURL= arg[0];
String sUsername = arg[1];
String sPassword = arg[2];
int blog_ID = 1;
String sXmlRpcMethod = "blogger.newPost";
// sXmlRpcMethod = "metaWeblog.newPost"; // I used this as well
String sTitle = "HI........";
String sContent = "Hello XML-RPC World!";
HashMap hmContent = new HashMap();
hmContent.put("title", sTitle);
hmContent.put("description", sContent);
boolean bPublish = true;
try {
XmlRpcClient client = new XmlRpcClient(sXmlRpcURL,true);
Object token = client.invoke( sXmlRpcMethod, new Object[] { new Integer( blog_ID ), sUsername, sPassword, hmContent, new Boolean( bPublish ) } );
System.out.println("Posted : " + (String) token);
}
catch (Exception e) {
}
please help me.
source
share