开发者

add a post / upload media to wordpress site through a C# / vb.net application?

Anyone know if its possible to add a post and upload images to a开发者_如何学JAVA wordpress blog (self hosted) via a .net application?

I see i could use XML-RPC.net to talk with the wordpress XML-RPC interface, but i see really few documentation and samples around.


You can use JoeBlogs library to access the API. Using that, working with the blog is very simple:

var blog = new WordPressWrapper("https://svicktest.wordpress.com/xmlrpc.php", "svicktest", "mypassword");

byte[] imageData = …;

var image = blog.NewMediaObject(new MediaObject { bits = imageData, name = "Plane.jpg", type = "image/jpeg"});

blog.NewPost(new Post { title = "Hello!", description = "Hello world! <img src=\"" + image.url + "\" />" }, true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜