Home >php教程 >php手册 >php向wordpress等支持xmlrpc的网站离线发帖的代码

php向wordpress等支持xmlrpc的网站离线发帖的代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:28:35887browse

上周做了一个银魂的网站 
http://www.iyinhun.com 
喜欢吐槽的热血动画的粉丝可以看看。

因为一个人做,比较吃力,我就想做一个自动维护程序(其实就是采集器的意思)
下面公布一下php向这类网站发送文章的代码(php向wordpress,blogbus,cnblogs等支持xmlrpc的网站离线发帖的代码)
分类属性(categories,mt_keywords)自己改。
附件里是wordpress xmlrpc协议的类库

function send_to_other($web,$title,$con,$USER,$PASS,$count=-1)  { 
		$client = new IXR_Client($web);
        $content['title'] = $title;
        //$get_post_info->post_category;
        $content['categories'] = array("同人");
        $content['description'] = $con;
       // $content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') );
        $content['mt_keywords'] = '同人';
    
		  if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true)) 
		        {
		            die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());  
		        }
		        $ID =  $client->getResponse();
		        
		        if($ID)
		        {
		           // echo 'Post published with ID:#'.$ID;
		        }    
		   return $post_ID;  
}  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn