Welcome
We've been working hard

How to use BT pagoda panel to automatically push website to Baidu

With this method, you can automatically push the website to Baidu webmaster platform every day. Xiaochen will use WP to explain the tutorial, This method is suitable for all station building systems.

Step 1: Create a new PHP file in the root directory of the site, such as tuisong.php, and copy the following code to add it to the tuisong.php file.

Note: There are two code links that need to be modified. The blogger has added a note at the end, remember to change it to his own, and then save it.

 

 <? php header('Content-Type:text/html; charset=utf-8'); /**Just modify the two links**/ $xml_url="https://Your domain name. com/sitemap. xml"// Modify the xml map link of your site here $baidu_api='Baidu webmaster gets the push interface link'// This is modified as the push interface you obtained from Baidu webmaster /***Just modify the two links**/ $xmldata =file_get_contents($xml_url); $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']; } //Baidu push interface only supports pushing 2000 pieces of data at a time, so if more than 2000 pieces of data are pushed, group push is required $url_group = array_chunk($url,2000); $count=count($url_group); for($i=0;$ i<$count;$i++){ $ch = curl_init(); $options = array( CURLOPT_URL => $baidu_api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode("\n",$url_group[$i]), CURLOPT_HTTPHEADER => array('Content-Type:text/plain'), ); curl_setopt_array($ch, $options); $result =curl_exec($ch); curl_close($ch); echo $result; } ?>

Note: For multiple sites, just refer to the two arrays in the example to add, and then save.

 <? php header('Content-Type:text/html; charset=utf-8'); // ini_set('max_execution_time',600);// Script timeout, in seconds, defined as needed /**Multiple sites only need to add arrays here**/ $data = array( array( 'url'=>'https://Your domain name. com/sitemap. xml',//here modify the xml map link of your site 'api'=>'The push interface link obtained by Baidu webmaster'//here is modified to the push interface obtained by Baidu webmaster ), array( 'url'=>'https://Your domain name. com/sitemap2. xml',//here modify the xml map link of your site 'api'=>'The push interface link obtained by Baidu webmaster'//here is modified to the push interface obtained by Baidu webmaster ), ); /**Multiple sites only need to add arrays here**/ foreach($data as $value){ echo '================================<br/>'; echo $value['url'].'< br/>'; post_Baidu($value['url'],$value['api']); } function post_Baidu($xml_url, $baidu_api) { $xmldata =file_get_contents($xml_url); $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']; } //Baidu push interface only supports pushing 2000 pieces of data at a time, so if more than 2000 pieces of data are pushed, group push is required $url_group = array_chunk($url,2000); $count=count($url_group); for($i=0;$ i<$count;$i++){ $ch = curl_init(); $options = array( CURLOPT_URL => $baidu_api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode("\n",$url_group[$i]), CURLOPT_HTTPHEADER => array('Content-Type:text/plain'), ); curl_setopt_array($ch, $options); $result =curl_exec($ch); curl_close($ch); echo $result.'<br/>'; } } ?>

 

Step 2: First log in to the pagoda panel background, find the planned task, and add a task type to access the URL. Copy and paste the file link directory we created into the URL address box, then set the execution cycle, and finally add tasks.

Like( zero ) Reward
Do not reprint without permission: New Start Blog » How to use BT pagoda panel to automatically push website to Baidu


Follow the public account "New Start Software Steward"

Get the latest network resources and cracking software!
Play with all kinds of software

comment Grab the sofa

You must log in before commenting!

 

Reward the author of the article if you think it is useful

Thank you very much for your reward, we will continue to give more high-quality content, let's create a better online world together!

Scan Alipay and reward

Scan WeChat and reward