近来发现bing的搜索量也越来越大了,为了更好的对必应进行seo优化,我们可以把最新的网站文章链接提交给必应IndexNow,以此来加快必应快速收录网站文章链接,那么我们我如何使用php代码来实现提交网站文章链接到必应IndexNow呢?
提交网站文章链接到必应IndexNow代码,IndexNow链接提交php代码。
1、登录https://www.bing.com/webmasters/必应站长平台,添加网站并通过验证。
2、进入https://www.bing.com/webmasters/indexnow点击Get Started进入获取key,并添加到网站根目录下。
3、把下方php代码复制到一个新建的php文件中,修改下网站域名、key、要提交的链接,保存放到php环境里运行即可。
<?php
$curl = curl_init();
$postdat = array(
'host' => 'yourdomain.com',
'key' => 'key',
'keyLocation' => 'http://yourdomain.com/key.txt',
'urlList' => array('http://yourdomain.com/1.html','http://yourdomain.com/2.html'),
);
$headers = array(
'Content-Type: application/json; charset=utf-8'
);
curl_setopt($curl, CURLOPT_URL,'https://api.indexnow.org/indexnow');
curl_setopt($curl, CURLOPT_POSTFIELDS,json_encode($postdat));
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($curl);
curl_close($curl);
echo '提交完成';
免责声明:
本页网址:点击复制分享给朋友吧!
本站分享的一切内容资源如若没有备注,均为蓝叶原创,如需转载请注明出处;如有侵权请与我们联系处理。敬请谅解!