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标签,也就是说这样的外链已经没有传递权重的作用 ...
随机推荐
- Thinking in life(1)
There is always one things we donot notice---time ,which is the most important to all of us.By watch ...
- clion 帮助文档 EN
下载时间 2015年10月 下载地址:http://pan.baidu.com/s/1E4fgE 备用地址:链接:http://pan.baidu.com/s/1bn6u5Wj 密码:icn4
- iOS上用FTGL显示定制Truetype字体碰到的问题
没想到这个问题搞了快2个月时间:当然跟我只是断断续续地工作有关. FTGL是freetype的opengl实现.我接触FTGL最初只是为了练习OpenGL,写几个简单的游戏app.开始试了试FTGL觉 ...
- JQuery绑定和注销事件
$('#action_list > li').each(function(){ $(this).unbind('click') .bind('click', function(){ /** so ...
- Codeforces Round #363 (Div. 2)->C. Vacations
C. Vacations time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- Kafka之ReplicaManager(1)
基于Kafka 0.9.0版 ReplicaManager需要做什么 Replicated Logs Kafka的partition可以看成是一个replicated log, 每个replica就是 ...
- unity3d结合轮廓显示,实现完整的框选目标(附Demo代码)
原地址:http://dong2008hong.blog.163.com/blog/static/469688272013111554511948/ 在unity里实现,其实很简单,因为有两个前提:1 ...
- hdu 4282 A very hard mathematic problem
由于k的范围是0-2^31,而且x,y,z都是正整数,由题易知道2<=z<31,1<=x<y;所以直接枚举就好了!!! #include<iostream> #in ...
- 转贴: A Simple c# Wrapper for ffMpeg
原帖地址:http://jasonjano.wordpress.com/2010/02/09/a-simple-c-wrapper-for-ffmpeg/ A Simple c# Wrapper fo ...
- 分布式内存对象缓存系统Memcached-Linux下使用
Linux下Memcached的使用 1. 安装文件下载 1.1下载memcached服务器端安装文件 版本: memcached-1.4.2.tar.gz 下载地址:http://www ...