I want to post a blog post to my wordpress site but create it using HTML code within a c# application. The reason for this is I have a template set up in wordpress for the specific type of post (it has buttons that link to a URL etc). How would I go about this in c#. I was using the XML-RPC package to create the new blog post, however it only handles basic things like title and content. My HTML code for the templated blog post looks like this:
TITLE GOES HERE
How would I send that through to wordpress via XML-RPC in c#? Existing code is:
using System;
using System.Windows.Forms;
using CookComputing.XmlRpc;
public struct blogInfo
{
public string title;
public string description;
}
public interface IgetCatList
{
[CookComputing.XmlRpc.XmlRpcMethod("metaWeblog.newPost")]
string NewPage(int blogId, string strUserName,
string strPassword, blogInfo content, int publish);
}
namespace WordpressBlogTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnPost_Click(object sender, EventArgs e)
{
blogInfo newBlogPost = default(blogInfo);
newBlogPost.title = txtTitle.Text;
newBlogPost.description = txtPost.Text;
IgetCatList categories = (IgetCatList)XmlRpcProxyGen.Create(typeof(IgetCatList));
XmlRpcClientProtocol clientProtocol = (XmlRpcClientProtocol)categories;
clientProtocol.Url = "https://myblog.com/xmlrpc.php";
string result = null;
result = "";
try
{
result = categories.NewPage(1, "username", "password", newBlogPost, 1); MessageBox.Show("Posted to Blog successfullly! Post ID : " + result); txtPost.Text = "";
txtTitle.Text = "";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
It will successfully post a new blog post from the 2 textboxes on the form once the button is pushed, but I want it to take HTML code and create the blog post from that rather than posting in string content.