每天随机推送100条链接至百度

433次浏览 更新日期:2022-10-22 21:57:35 分类:谈天说地 评论:1
$file =  file("sitemap.txt");
$count = count($file);
$num = "100";
$random_keys = array_rand($file,$num);

$urls = array();
for($i = 0 ; $i<$num; $i++){
    $urls[]=$file[$random_keys[$i]];
}

$api = ';
$ch = curl_init();
$options =  array(
    CURLOPT_URL => $api,
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => implode("\n", $urls),
    CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo $result;


我来说两句
  • lpf513
    lpf513 1年前
    这串代码怎么用
    0
    回复
作者信息
发布见解
发内容 回顶部