Automatically Read Sitemap and Submit to Baidu Webmaster with PHP
Some websites automatically generate a sitemap.xml
file, so we don’t need to manually update the URLs. We just need a function to read the sitemap.xml
file and then submit it to Baidu Webmaster with one click.
Code
We use PHP’s built-in simplexml_load_file
function to read the sitemap.xml
file and use curl to submit these links to Baidu Webmaster.
1 | $site = "Website Address"; |
The overall implementation is relatively simple. After reading, it automatically generates an array, which can be directly used in the curl submission.
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 程俞客&称心号!
评论