MetaWeblog also manages blogs such as 51cto,csdn,sina,163,oschina,cnblogs

Source: Internet
Author: User
Tags repetition xml example

Our technical people will usually have their own blog, used to record some technical notes, but also hope that their own note articles can be more people know.

How do I get more people to know their blogs?

    • Search engine indexed, the user may enter by keyword searches

    • Content operations, but the general technical person for the article to do the operation of people should not have a few

    • Flow through the same type of site with a large volume


I am using method one and method three, the method does not say, the Internet people know, but the small site effect will not be too good. Method three is to act as a repetition machine: copy and paste to other technical websites


"Copy and paste to other technology sites" easy to put away, this TM is a physical life, who would like to write an article and take up half an hour, synchronization to the various technical sites and forums.


What I have recorded this time is how to manage the synchronization easily and conveniently? MetaWeblog, right is this noun, this is also an agreement, I know the major technical sites have basically achieved this agreement, through this agreement we can to the major technical website through the interface directly sync blog. As a technician or to keep up with the times, always learning ah, I accidentally have the idea to check some information to know the agreement, but this agreement was put forward in 2002, until today, it is really a shame


MetaWeblog client is also based on the HTTP protocol, the data message is XML, that is, in accordance with the specified XML format, send HTTP requests.

Database message format can refer to the official website description: http://xmlrpc.scripting.com/metaWeblogApi.html

The official XML example can be consulted: http://cyber.law.harvard.edu/blogs/gems/tech/sampleMetaweblogCall.txt


MetaWeblog has several common APIs

api name description
metaweblog.newpost publish new article
metaweblog.editpost Edit article
metaweblog.getpost get article
metaweblog.getrecentposts Get recent articles
metaweblog.getcategories get class


Basic brain to forget, say to realize the structure of it


1. I have created two related tables Blog_sync_queue and blog_sync_mapping

create table  ' Blog_sync_queue '   (   ' id '  int ( One)  unsigned NOT NULL AUTO_INCREMENT,   ' blog_id '  int (one)  not null  COMMENT  ' site Blog id ',   ' type '  varchar (Ten)  NOT NULL DEFAULT  '   comment  ' type ',   ' status '  tinyint (1)  NOT NULL DEFAULT  ' 0 '  comment   ' status:-1:  to run  0:  failed  1: Success ',   ' Updated_time '  timestamp not null  DEFAULT  ' 0000-00-00 00:00:00 '  COMMENT  ' last update time ',   ' created_time '   timestamp not null default  ' 0000-00-00 00:00:00 '  COMMENT  ' insertion time ',   PRIMARY KEY  (' id '))  engine=innodb  default charset=utf8 comment= ' Blog synchronization queue '; 
create table  ' blog_sync_mapping '   (   ' id '  int (one)  unsigned NOT  null auto_increment,   ' blog_id '  int (one)  NOT NULL COMMENT  ' ID of this site blog ',    ' cto51_id '  varchar (+)  NOT NULL DEFAULT  '  COMMENT  ' 51cto blog id ' ,   ' csdn_id '  varchar ( NOT NULL DEFAULT  '  COMMENT  ' csdn's ID '),    ' sina_id '  varchar  NOT NULL DEFAULT  '  COMMENT  ' Sina blog id ',    ' netease_id '  varchar (+)  NOT NULL DEFAULT  '  COMMENT  ' netease blog id ',    ' oschina_id '  varchar  NOT NULL DEFAULT  '  COMMENT  ' open source China id ',    ' cnblogs_id '  varchar (+)  NOT NULL DEFAULT  '  COMMENT  ' the ID of the blog Park ',    ' updated_time '  timestamp NOT NULL DEFAULT  ' 0000-00-00 00:00:00 '  COMMENT  ' last moreNew Time ',   ' created_time '  timestamp NOT NULL DEFAULT  ' 0000-00-00 00:00:00 '  COMMENT  ' insertion time ',  primary key  (' id '))  engine=innodb  default  charset=utf8 comment= ' This station blog_id  and other synchronization site ID relationship ';

2. Each blog change I will insert a record in blog_sync_queue, for example, I want to cnblogs submit my personal Blog ID 6 of the blog

INSERT into ' blog_sync_queue ' (' id ', ' blog_id ', ' type ', ' status ', ' Updated_time ', ' Created_time ') VALUES (6, ' cnblogs ') ,-1, ' 2016-01-09 00:09:38 ', ' 2016-01-08 23:36:40 ');


3. Write a PHP script that configures Crontab to run every 5 minutes

This script is a result set that queries status =-1 from Blog_sync_queue and then submits to the specified Web site via the MetaWeblog interface


Let's take a few pictures and watch the effect of the automatic repetition machine.


PS:CSDN has not been implemented, mainly csdn sometimes seems to be a server metaweblog problem, still in the study



Interested friends can contact me via email and WeChat through this site


The original address: MetaWeblog also manage 51cto,csdn,sina,163,oschina,cnblogs and other blogs

MetaWeblog also manage blogs such as 51cto,csdn,sina,163,oschina,cnblogs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.