推荐 通过随机二次元壁纸接口向齐博x1 bbs系统发布信息


<?php
// 通过随机二次元壁纸接口向齐博x1 bbs系统发布信息
// 用到了插件:xtool站长超级工具箱-的采集发布接口

// 定义头部信息
$url = "https://api.gumengya.com/Api/DmImg?format=image";;

$options = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false
    )
);
stream_context_set_default($options);

$response = file_get_contents($url);

$headers = get_headers($url, 1);
$imageUrl = $headers['Location'];

$filename = "二次元壁纸标题.txt";//帖子标题保存在此文件
$file = file($filename, FILE_IGNORE_NEW_LINES); // 读取文件内容并存储为数组
$randomLine = $file[array_rand($file)]; // 从数组中随机抽取一行

$text = $randomLine;
$picurls = $imageUrl;//得到一张图片

$randomNumber = rand(200000183, 200001888);//随机uid等于:200000183到200001888之间任意用户

// 构建 POST 请求的数据
$postData = array(
    'mid' => 1,//模型ID
    'fid' => '',//栏目ID
    'kwtags' => '',//关键词可为空
    'dirname' => 'bbs',//模块名
    'passwd' => 'passwd',//后台的密码
    'content' => $text,//内容
    'title' => $text,//标题
    'ext_id' => '',//圈子ID可为空
    'uid' => $randomNumber,//用户UID
    'picurl' => $picurls,//图片
);

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, 'https://www.****.com/index.php/index/plugin/execute/plugin_name/xtool/plugin_controller/caiji/plugin_action/add');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($curl);

if ($result === false) {
    // 处理请求失败的情况
    $error = curl_error($curl);
    echo "Error: " . $error;
} else {
    // 处理请求成功的情况
    var_dump($result);
}

curl_close($curl);
?>

然后我们可以通过宝塔的计划任务,定时反问此页面实现自动发布

本文链接:https://x1.wanxiangsucai.com/read/453.html
没有了后一页 齐博x1云标签插件-一..其中20代表取标题多少个字, 为了排版需要,你不想要标题的话,可以换成字符,比如 上一页

上一篇:

下一篇:齐博x1云标签插件-一件提取关键词无法使用的解决办法

建站工具推荐

  • 收录查询工具
  • Layui - 极简模块化前端 UI 组件库(官方文档)
  • WHOIS查询工具
  • SEO综合查询工具