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

半城伤御伤魂 提交于 2019-12-06 14:35:16

问题


Anyone know if its possible to add a post and upload images to a 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.


回答1:


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);


来源:https://stackoverflow.com/questions/5767090/add-a-post-upload-media-to-wordpress-site-through-a-c-sharp-vb-net-applicati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!