blog post list.html,Posting a blog post in wordpress as HTML using c#

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值