开发者

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

开发者 https://www.devze.com 2023-02-28 02:49 出处:网络
Anyone know if its possible to add a post and upload images to a开发者_如何学JAVA wordpress blog (self hosted) via a .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

精彩评论

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