分享一段可以自动推送百度mip的PHP代码,可参考的推送链接格式为:您的域名/随机字符/随机字.html;
您可以把这段代码编辑成php格式,只用宝塔自动访问PHP文件即可!
懂代码的可以自行学习看看,循环推送,每次推送100条直到全部推送完毕。
<?php $server_name = $_SERVER['SERVER_NAME']; // function rand_str($count = 5) // { // $range_array = array_merge(range(0, 9), range('A', 'Z')); // $str = ''; // foreach ( array_rand($range_array, $count) as $value) // { // $str .= $range_array[$value]; // } // return $str; // } function rand_str($length = 5) { $str = ''; $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $max = strlen($strPol)-1; for($i = 0; $i < $length; $i++) { $str .=$strPol[rand(0,$max)]; } return $str; } $count = 100; $urls = array(); for ($i = 0; $i < $count; $i++) { $urls[] = "http://{$server_name}/".rand_str().'/'.rand_str().'.html'; } $api = "http://data.zz.baidu.com/urls?site={$server_name}&token=您的token&type=mip"; $ch = curl_init(); $options = array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode(" ", $urls), CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), ); curl_setopt_array($ch, $options); $result = curl_exec($ch); echo $result; ?>