Use Pagoda panel scheduled tasks to automatically push website sitemap.xml to Baidu search engine¶
Original link: https://www.itylq.com/bt-panel-autoput-sitemap-xml.html
Release date: 2022-10-23 Migration time: 2026-03-21
There are many ways for wordpress to push article links to Baidu search engine. The more common scripts are automatic push scripts, automatic push plug-ins, etc. Today I will introduce a novel push method, which is to push the entire sitemap to the search engine through the scheduled task of the Pagoda panel. The details are as follows:
Create a new folder in the root directory of the website that needs to be pushed, and create a new PHP file, such as xml-autoput.php. Add the file address to the pagoda scheduled task, select the access URL, customize the execution time, and save it.
Note: Please remember to modify the website sitemap.xml address and Baidu push interface in the following code during actual use.
xml-autoput.php file code:
<?php
header(‘Content-Type:text/html;charset=utf-8′);
//Modify the path to the sitemap.xml file of your own website
$xmldata =file_get_contents(“https://own website/sitemap.xml”);
$xmlstring = simplexml_load_string($xmldata,’SimpleXMLElement’,LIBXML_NOCDATA);
$value_array = json_decode(json_encode($xmlstring),true);
$url = [];
for ($i =0;$i < count($value_array[‘url’]);$i++){
echo $value_array[‘url’][$i][‘loc’].”<br/>”;
$url[]= $value_array[‘url’][$i][‘loc’];
}
//Modify to the push api corresponding to your own website. If not available, it will be automatically generated after adding the website on Baidu Webmaster Platform.
$api =’Baidu webmaster’s push interface’;
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode(“\n”,$url),
CURLOPT_HTTPHEADER => array(‘Content-Type: text/plain’),
);
curl_setopt_array($ch, $options);
$result =curl_exec($ch);
echo $result;
?>
Successful task execution will return:
This article was moved from WordPress to MkDocs