asp.net批量发布博客到各大博客平台
新浪博客 http://upload.move.blog.sina.com.cn/blog_rebuild/blog/xmlrpc.php
网易博客 http://os.blog.163.com/api/xmlrpc/metaweblog/
自建Wordpress站点 http://您的博客地址/xmlrpc.php
博客园cnblogs 博客园 - 开发者的网上家园<您的用户名>/services/metaweblog.aspx
自建zBlog站点 http://your.zblog.site/xml-rpc/index.asp
CSDN博客官方已经禁用了API发布功能,此插件对CSDN博客已失效
端口:通常是80
用户名/密码:您的博客的用户名和密码
博客API:请选择MetaWeblog API。这是被绝大部分博客支持的API,包括新浪,网易,官方wordpress,自建的wordpress等等。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LitJson;
using metaWeblogTest; public partial class ceshi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
M_MetaWeblog m_blog = new M_MetaWeblog();
//m_blog.Url = "http://www.cnblogs.com/webapi/services/metaweblog.aspx";//博客园
m_blog.Url = "http://upload.move.blog.sina.com.cn/blog_rebuild/blog/xmlrpc.php";//sina Post newPost = new Post();
newPost.dateCreated = DateTime.Now;
newPost.title = "发布测试1";
newPost.description = "发布测试1描述"; //string res=m_blog.newPost("id", "博客园用户名", "博客园密码", newPost, true);//博客园
string res = m_blog.newPost("id", "sina博客用户名", "sina博客密码", newPost, true);//sina
Response.Write(res); }
}
metaWeblogTest.cs源码
using System;
using CookComputing.XmlRpc; namespace metaWeblogTest
{ #region 微软MSN网站 使用的 MetaWeblog API.
/// 这个结构代表用户的博客基本信息
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct UserBlog
{
public string url;
public string blogid;
public string blogName;
} /// <summary>
/// 这个结构代表用户信息
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct UserInfo
{
public string url;
public string blogid;
public string blogName;
public string firstname;
public string lastname;
public string email;
public string nickname;
} /// <summary>
/// 这个结构代表博客分类信息
/// 这后面的getCategories()方法会取到CATEGORY数据。
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct Category
{
public string description;
public string title;
} /// <summary>
/// 这个结构代表博客( 文章 )信息。
/// 这后面的 editPost()方法, getRecentPosts()方法 和 getPost()方法 会取倒POST数据 .
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct Post
{
public DateTime dateCreated;
public string description;
public string title;
public string postid;
public string[] categories;
}
#endregion #region 网站:http://msdn.microsoft.com/en-us/library/aa905670.aspx
///// <summary>
///// 微软MSN网站 使用的 MetaWeblog API.
//// 网站:http://msdn.microsoft.com/en-us/library/aa905670.aspx
///// </summary>
public class M_MetaWeblog : XmlRpcClientProtocol
{ /// <summary>
/// Returns the most recent draft and non-draft blog posts sorted in descending order by publish date.
/// </summary>
/// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="numberOfPosts"> The number of posts to return. The maximum value is 20. </param>
/// <returns></returns>
/// TODO:得到最近发布的帖子
[XmlRpcMethod("metaWeblog.getRecentPosts")]
public Post[] getRecentPosts(
string blogid,
string username,
string password,
int numberOfPosts)
{ return (Post[])this.Invoke("getRecentPosts", new object[] { blogid, username, password, numberOfPosts });
} /// <summary>
/// Posts a new entry to a blog.
/// </summary>
/// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="post"> A struct representing the content to update. </param>
/// <param name="publish"> If false, this is a draft post. </param>
/// <returns> The postid of the newly-created post. </returns>
/// TODO:增加一个最新的帖子
[XmlRpcMethod("metaWeblog.newPost")]
public string newPost(
string blogid,
string username,
string password,
Post content,
bool publish)
{ return (string)this.Invoke("newPost", new object[] { blogid, username, password, content, publish });
} /// <summary>
/// Edits an existing entry on a blog.
/// </summary>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="post"> A struct representing the content to update. </param>
/// <param name="publish"> If false, this is a draft post. </param>
/// <returns> Always returns true. </returns>
/// TODO:更新一个帖子
[XmlRpcMethod("metaWeblog.editPost")]
public bool editPost(
string postid,
string username,
string password,
Post content,
bool publish)
{ return (bool)this.Invoke("editPost", new object[] { postid, username, password, content, publish });
} /// <summary>
/// Deletes a post from the blog.
/// </summary>
/// <param name="appKey"> This value is ignored. </param>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="post"> A struct representing the content to update. </param>
/// <param name="publish"> This value is ignored. </param>
/// <returns> Always returns true. </returns>
/// TODO:删除一个帖子
[XmlRpcMethod("blogger.deletePost")]
public bool deletePost(
string appKey,
string postid,
string username,
string password,
bool publish)
{ return (bool)this.Invoke("deletePost", new object[] { appKey, postid, username, password, publish });
} /// <summary>
/// Returns information about the user’s space. An empty array is returned if the user does not have a space.
/// </summary>
/// <param name="appKey"> This value is ignored. </param>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"></param>
/// <returns> An array of structs that represents each of the user’s blogs. The array will contain a maximum of one struct, since a user can only have a single space with a single blog. </returns>
/// TODO:得到用户的博客清单
[XmlRpcMethod("blogger.getUsersBlogs")]
public UserBlog[] getUsersBlogs(
string appKey,
string username,
string password)
{ return (UserBlog[])this.Invoke("getUsersBlogs", new object[] { appKey, username, password });
} /// <summary>
/// Returns basic user info (name, e-mail, userid, and so on).
/// </summary>
/// <param name="appKey"> This value is ignored. </param>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"></param>
/// <returns> A struct containing profile information about the user.
/// Each struct will contain the following fields: nickname, userid, url, e-mail,
/// lastname, and firstname. </returns>
/// TODO:得到用户信息
[XmlRpcMethod("blogger.getUserInfo")]
public UserInfo getUserInfo(
string appKey,
string username,
string password)
{ return (UserInfo)this.Invoke("getUserInfo", new object[] { appKey, username, password });
} /// <summary>
/// Returns a specific entry from a blog.
/// </summary>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <returns> Always returns true. </returns>
/// TODO:获取一个帖子
[XmlRpcMethod("metaWeblog.getPost")]
public Post getPost(
string postid,
string username,
string password)
{ return (Post)this.Invoke("getPost", new object[] { postid, username, password });
} /// <summary>
/// Returns the list of categories that have been used in the blog.
/// </summary>
/// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <returns> An array of structs that contains one struct for each category. Each category struct will contain a description field that contains the name of the category. </returns>
/// TODO:得到博客分类
[XmlRpcMethod("metaWeblog.getCategories")]
public Category[] getCategories(
string blogid,
string username,
string password)
{ return (Category[])this.Invoke("getCategories", new object[] { blogid, username, password });
}
}
#endregion
}
需要引用CookComputing.XmlRpcV2.dll
asp.net批量发布博客到各大博客平台的更多相关文章
- MWeb 1.3.7 发布!增加发布到 Wordpress 等支持 MetaWeblog API 的服务,如:Wordpress 博客、新浪博客、cnblogs、oschina。
MWeb 1.3.7 版的新功能 增加发布到 Wordpress 等支持 Metaweblog API 的服务,目前经测试过的有: Wordpress 博客.新浪博客.cnblogs.oschina. ...
- Asp.Net MVC 进阶篇:路由匹配 实现博客路径 和文章路径
Asp.Net MVC 进阶篇:路由匹配 实现博客路径 和文章路径 我们要实现 通过路由 匹配出 博客地址 和博客文章地址 例如下面的这两个地址 //http://www.cnblogs.com/ma ...
- ASP.NET 程序发布详细过程
前言 ASP.NET网站的发布,无论是初学者还是高手,在程序的发布过程中或多或少会存在一些问题,譬如VS发布ASP.NET程序失败.IIS安装失败.IIS发布失败.局域网内不能访问 配置文件错误.权限 ...
- asp.net程序发布详解
本文转载自Alan_beijing的博客ASP.NET 程序发布详细过程.内容进行了部分更改. ASP.NET网站的发布,无论是初学者还是高手,在程序的发布过程中或多或少会存在一些问题,譬如VS发布A ...
- 【ASP.NET MVC系列】浅谈ASP.NET 程序发布过程
ASP.NET MVC系列文章 [01]浅谈Google Chrome浏览器(理论篇) [02]浅谈Google Chrome浏览器(操作篇)(上) [03]浅谈Google Chrome浏览器(操作 ...
- 转载 ASP.NET SignalR 与LayIM配合,轻松实现网站客服聊天室(一) 整理基础数据
ASP.NET SignalR 与LayIM配合,轻松实现网站客服聊天室(一) 整理基础数据 最近碰巧发现一款比较好的Web即时通讯前端组件,layim,百度关键字即可,我下面要做的就是基于这个前 ...
- 自动发布-asp.net自动发布、IIS站点自动发布(集成SLB、配置管理、Jenkins)
PS:概要.背景.结语都是日常“装X”,可以跳过直接看自动发布 环境:阿里云SLB.阿里云ECS.IIS7.0.Jenkins.Spring.Net 概要 公司一个项目从无到有,不仅仅是系统从无到有的 ...
- ASP.NET Core 发布至Linux生产环境 Ubuntu 系统
ASP.NET Core 发布至Linux生产环境 Ubuntu 系统,之前跟大家讲解了 dotnet publish 发布,而没有将整个系统串起来. 今天就跟大家综合的讲一下ASP.NET Core ...
- 继网易博客后搜狐博客也增加了nofollow标签
继网易博客后搜狐博客也增加了nofollow标签 今天在搜狐博客发表了篇文章,在末端添加上我的版权,结果回头查看是发现,这个锚文本被加上了nofollow标签,也就是说这样的外链已经没有传递权重的作用 ...
随机推荐
- MSAA
多重采样抗锯齿(MultiSampling Anti-Aliasing,簡稱MSAA)是一种特殊的超级采样抗锯齿(SSAA).MSAA首先来自于OpenGL.具体是MSAA只对Z缓存(Z-Buffer ...
- hadoop浅尝 第一个hadoop程序
hadoop编程程序员需要完成三个类. map类,reduce类和主类. map和reduce类自然是分别完成map和reduce.而主类则负责对这两个类设置job.完成这三个类之后,我们生成一个ja ...
- structs spring hibernate 三者之间有什么关系?
现在开发流行MVC模式,structs在C(控制器)中使用:hibernate在M(模型)中被使用:至于 spring ,最大的作用在于,structs.hibernate的对象,由于在各个层之间相互 ...
- package.json 字段全解析 share
Name 必须字段. 小提示: 不要在name中包含js, node字样: 这个名字最终会是URL的一部分,命令行的参数,目录名,所以不能以点号或下划线开头: 这个名字可能在require()方法中被 ...
- 关于项目中遇到的NullPointerException异常时处理手段
在项目开发中,经常会遇到NullPointerException异常,特别是一些新手,非常的郁闷,有时候会很隐蔽,特别是不同的人书写的代码进行调用时. 以下是我所遇到的NullPointerExcep ...
- *[codility]MinAvgTwoSlice
https://codility.com/demo/take-sample-test/min_avg_two_slice 此题要求一个数组子段的最小的平均数(返回第一个数字的index).刚开始想记录 ...
- java nio管道
管道(Pipe) (本部分原文链接,作者:Jakob Jenkov,译者:黄忠,校对:丁一) Java NIO 管道是2个线程之间的单向数据连接.Pipe有一个source通道和一个sink通道.数据 ...
- Android:利用SharedPreferences实现自动登录
主要代码: public class LoginActivity extends Activity { private EditText username; private EditText user ...
- 为什么国外程序员爱用Mac?
Mac 在国外很受欢迎,尤其是在 设计/web开发/IT 人员圈子里.普通用户喜欢 Mac 可以理解,毕竟 Mac 设计美观,简单好用,没有病毒.那么为什么专业人士也对 Mac 情有独钟呢?从个人使用 ...
- Java API —— 编码 & IO流( InputStreamReader & OutputStreamWriter & FileReader & FileWriter & BufferedReader & BufferedWriter )
1.编码 1)编码表概述 由字符及其对应的数值组成的一张表 2)常见编码表 · ASCII/Unicode 字符集:ASCII是美国标准信息交换码,用一 ...