当前位置:Gxlcms > PHP教程 > php向wordpress等支持xmlrpc的网站离线发帖的代码_PHP教程

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

时间:2021-07-01 10:21:17 帮助过:17人阅读

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

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

  1. function send_to_other($web,$title,$con,$USER,$PASS,$count=-1) {
  2. $client = new IXR_Client($web);
  3. $content['title'] = $title;
  4. //$get_post_info->post_category;
  5. $content['categories'] = array("同人");
  6. $content['description'] = $con;
  7. // $content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') );
  8. $content['mt_keywords'] = '同人';
  9. if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true))
  10. {
  11. die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
  12. }
  13. $ID = $client->getResponse();
  14. if($ID)
  15. {
  16. // echo 'Post published with ID:#'.$ID;
  17. }
  18. return $post_ID;
  19. }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/444555.htmlTechArticle上周做了一个银魂的网站 http://www.iyinhun.com 喜欢吐槽的热血动画的粉丝可以看看。 因为一个人做,比较吃力,我就想做一个自动维护程序(其实...

人气教程排行