php推送百度指令碼(泛目錄版本)
阿新 • • 發佈:2021-01-31
技術標籤:php
這個指令碼是推送隨機url到百度,加快百度收錄~
指令碼內容:
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 = 50;
$urls = array();
for ($i = 0; $i < $count; $i++)
{
$urls[] = "http://域名/".rand_str().'/'.rand_str().'.html';
}
$api = "呼叫的百度api";
echo $urls;
$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;
如果還是不會可以在下面評論或者去群裡下載