百度官方收录推送代码:
$urls = array(
'http://www.example.com/1.html',
'http://www.example.com/2.html',
);
$api = 'http://data.zz.baidu.com/urls?site=https:// 你的域名 /&token=** 填你自己的 token**';
$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;
优化后百度提交收录代码:
说明:只要有用户打开代码所在的网页,就会自动提交该页面给百度收录。该代码适合任何程序的网站。
欢迎打赏
