帝国cms微博群发插件教程支持28个微博平台支持定时发布

2023-12-01 0 694

一、说明:

1、这个函数由微博通wordpress插件修改过来。可以实现群发微博,前提条件是你在各大微博都有注册。可以实现定时发布。

定时发的时候"发布微博"选空。

2、升级以后批量更新不会群发微博,修改文章的时候选1为发布微博,0为不发布,定时发布的时候选空。

3、插件如果是在UTF-8的编码下使用需要改代码,如果单纯复制使用只适合GBK版本。

二、操作方法:

1、先新建一个字段,注:初始值是3个值:0为不发布;1为发布;空未审核。

字段名:"weibo"

字段标识:"发布微博"

初始值:

0:default

1

(空也就是回车)

2、以下函数放入userfun.php中 。

<?php//—————————微博发布函数function send_to_wbto($id) {global $empire,$dbtbpre,$public_r,$navinfor ;$rr = $empire->fetch1("select * from {$dbtbpre}ecms_news_data_1,{$dbtbpre}ecms_news where {$dbtbpre}ecms_news_data_1.id = '".$id."' and {$dbtbpre}ecms_news_data_1.id = {$dbtbpre}ecms_news.id limit 1");$title = $rr[title] ;$content =esub(strip_tags($rr[smalltext]),200); $url = $rr[titleurl] ;$title1 = $title.'//'.$content.$rr[titleurl];preg_match_all('/<img[^>]+src=['"](http[^'"]+)['"].*>/isU',$rr[newstext], $image);//匹配图像格式$p_sum = count($image[1]);if ($p_sum > 0) {$p = $image[1][0];}if (!$p) {$p = $rr[titlepic];}$username = 'xxxxx';$password = 'xxxxx';$image_url = $p;$title1 = iconv('GB2312', 'UTF-8',$title1); //将字符串的编码从GB2312转到UTF-8,如果是UTF-8段代码可以注释掉$fields = array();$fields['source'] = 'wordpress';$fields['content'] = urlencode($title1); //$ch = curl_init();if ($image_url) { $fields['imgurl'] =$image_url;curl_setopt($ch, CURLOPT_URL, "http://wbto.cn/api/upload.json"); } else {curl_setopt($ch, CURLOPT_URL, "http://wbto.cn/api/update.json"); }curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);curl_setopt($ch, CURLOPT_TIMEOUT, 10);curl_setopt($ch, CURLOPT_POST, TRUE);curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);$result = curl_exec($ch);curl_close($ch);}?>

3、建一个公共变量"weibo_se"

<?php $rrr2 = $empire->fetch1(" select * from {$dbtbpre}ecms_news where id='".$navinfor['id']."' limit 1 "); $sql = $empire->query1(" UPDATE {$dbtbpre}ecms_news set weibo='0' where id='".$navinfor['id']."' "); if(function_exists('send_to_wbto') ) {if($rrr2['weibo']=='1'||$rrr2['weibo']=='' ){send_to_wbto($navinfor['id']) ;} } ?>

4、[!–temp.weibo_se–]放入内容模板中

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 帝国CMS教程 帝国cms微博群发插件教程支持28个微博平台支持定时发布 https://www.u-9.cn/jiaocheng/empirecms/14758.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务