Table of Contents
Tutorial on pushing the Dreamweaver sitemap map to Baidu in real time, Dreamweaver sitemap
Home Backend Development PHP Tutorial A tutorial on how to push the Dreamweaver sitemap map to Baidu in real time, Dreamweaver sitemap_PHP tutorial

A tutorial on how to push the Dreamweaver sitemap map to Baidu in real time, Dreamweaver sitemap_PHP tutorial

Jul 13, 2016 am 09:45 AM
real time push dream weaving

Tutorial on pushing the Dreamweaver sitemap map to Baidu in real time, Dreamweaver sitemap

Before, Dreamweaver had a set of plug-ins for actively pinging Baidu, but later it became unusable. In the end Baidu has launched a real-time push link address to Baidu. This is much more convenient and easier to use than sitemap, and it can also ensure the originality of the article. Below, I read the relevant information and wrote an article based on Baidu's interface to push the sitemap map to Baidu in real time. Share the solution with everyone.

I have written two methods about Baidu real-time push of Dreamweaver, you can choose by yourself:

1. Manually create a file and access this file every day to push all the articles of the day to the Baidu search engine. Create a tuisong.php under the root directory and after accessing it, the Baidu interface results will be returned

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

<&#63;php

require_once ("include/common.inc.php");

require_once "include/arc.partview.class.php";

require_once('include/charset.func.php');

$year = date("Y");

$month = date("m");

$day = date("d");

$dayBegin = mktime(0,0,0,$month,$day,$year);//当天开始时间戳

$dayEnd = mktime(23,59,59,$month,$day,$year);//当天结束时间戳

$query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<".$dayEnd." AND pubdate>".$dayBegin.""; //这里dede换成你们自己的表前缀

$urls="";

$dsql->Execute('arch.id,types.typedir',$query);

while($row = $dsql->GetArray('arch.id,types.typedir'))

{

 $urls.="http://www.baidu.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";

 //将上边的http://baidub.com换成你的网址

}

$urls=substr($urls,0,-1);

$urls = explode(",",$urls);

$api = 'http://data.zz.baidu.com/urls&#63;site=www.baidu.com&token=hereistoken'; // 前边的site换成自己的site xxx换成自己的密钥

$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.count($urls);

&#63;>

Copy after login

View push feedback

Push successful

The status code is 200 and the following fields may be returned:
Field Is it required? Parameter type Description
success is int the number of urls successfully pushed
remain is int the remaining number of pushable URLs on the day
not_same_site No array List of URLs that have not been processed because they are not the URLs of this site
not_valid No array Illegal url list
Successful return example:

Copy code The code is as follows:
{
"remain":4999998,
"success":2,
"not_same_site":[],
"not_valid":[]
}

Push failed

The status code is 4xx, and the return fields are:
Field Type Description
error is an int error code, the same as the status code
message is string error description
Failure return example:

Copy code The code is as follows:
{
"error":401,
"message":"token is not valid"
}

2. The second way is to publish an article, just like Baidu pushes it once. This is more convenient, and this is what I use

Open the article_add.php file in Dreamweaver Backend. Find almost 262 lines

Note:
If your system settings-》Core Options

If it is direct. Add the following code, otherwise pay attention to the following tips

1

2

3

4

5

6

7

8

9

10

11

12

13

14

//百度推送

$urls="http://www.baidu.com".$artUrl;//前面域名换成你自己的 如果上面图片选择的是是 就把"http://baidu.com". 去掉

$urls = explode(",",$urls);

$api = 'http://data.zz.baidu.com/urls&#63;site=www.0cx.cc&token=hereistoken'; // 前边site换成自己的site xxx换成自己的密钥

$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);

Copy after login

It’s OK. If you want to see whether the addition is successful, you can modify the following one or two lines of code

Copy code The code is as follows:
Please select your subsequent operation ".$result.$urls[0].":

result refers to the results returned by Baidu, and urls refers to the URLs you push.

It’s basically OK. If you want the article to be pushed when you modify it, just modify article_edit.php like I did above.

The above is the entire content of this article, I hope you all like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1042682.htmlTechArticle Tutorial on pushing the Dreamweaver sitemap map to Baidu in real time, Dreamweaver sitemap In the past, Dreamweaver had a set of self-initiated pings Baidu's plug-in, but it became unusable. Finally, Baidu launched real-time push...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

UniApp implements real-time push techniques for push messages and notifications UniApp implements real-time push techniques for push messages and notifications Jul 04, 2023 am 11:34 AM

UniApp implements real-time push techniques for push messages and notifications In modern society, the push message and notification functions of mobile applications are becoming more and more important. As users have higher and higher demands for real-time information, developers are constantly exploring how to implement real-time push in mobile applications. As a cross-platform development framework, UniApp provides developers with a simple and efficient way to implement real-time push messages and notifications. UniApp is a cross-platform development framework developed based on Vue.js. It supports the integration of a set of codes into

How to implement real-time data push function in MongoDB How to implement real-time data push function in MongoDB Sep 21, 2023 am 10:42 AM

How to implement real-time data push function in MongoDB MongoDB is a document-oriented NoSQL database, which is characterized by high scalability and flexible data model. In some application scenarios, we need to push data updates to the client in real time in order to update the interface or perform corresponding operations in a timely manner. This article will introduce how to implement the real-time push function of data in MongoDB and give specific code examples. There are many ways to implement real-time push functionality, such as using polling, long polling, Web

How to import css in DreamWeaver How to import css in DreamWeaver Dec 03, 2020 pm 04:03 PM

How to import css into DreamWeaver: 1. Place the HTML template file in the "templets" folder; 2. Change the suffix of the HTML file to ".htm"; 3. Add "{dede:" in front of the original style path: global.cfg_templets_skin/}" can be used.

How to use Vue and Axios to achieve real-time push and update of data How to use Vue and Axios to achieve real-time push and update of data Jul 17, 2023 am 08:58 AM

How to use Vue and Axios to achieve real-time push and update of data Introduction: In modern web applications, real-time data push and update has become a common requirement. As a popular front-end framework, Vue can easily interact with the back-end for data interaction and real-time updates. Axios is a Promise-based HTTP library that can easily send asynchronous requests. This article will introduce how to use Vue and Axios to achieve real-time push and update of data. 1. Overview of realizing real-time push of data and

Decryption of real-time push and message broadcast technology of swoole development function Decryption of real-time push and message broadcast technology of swoole development function Aug 04, 2023 pm 01:57 PM

Decryption of real-time push and message broadcast technology developed by Swoole With the rapid development of the Internet, real-time push and message broadcast technology play an increasingly important role in various network applications. Swoole, as an efficient and development-friendly PHP extension, provides developers with powerful real-time communication capabilities. This article will introduce the real-time push and message broadcast technology in Swoole development functions, and provide some code examples. What is Swoole? Swoole is a coroutine concurrent network based on PHP language

PHP WebSocket development technology sharing: the best strategy to implement real-time push function PHP WebSocket development technology sharing: the best strategy to implement real-time push function Sep 11, 2023 pm 01:24 PM

PHPWebSocket development technology sharing: The best strategy to implement real-time push function With the rapid development of the Internet and the gradual increase in user demand for real-time information, real-time push has become an indispensable part of modern Web applications. As an open standard, WebSocket technology provides a two-way communication capability, making it an ideal choice for realizing real-time push functions. This article will share some of the best strategies for PHP WebSocket development to help developers implement real-time push functions quickly and efficiently.

Java development: How to use WebSocket to implement real-time push function Java development: How to use WebSocket to implement real-time push function Sep 20, 2023 am 09:09 AM

Java Development: Using WebSocket to Implement Real-Time Push Function Introduction: In modern web applications, the transmission of real-time data is becoming more and more important. WebSocket is a protocol that provides two-way real-time communication between client and server, which can transfer data without refreshing the page. This article will introduce how to use Java language and Spring framework to implement real-time push function through WebSocket, and provide specific code examples. Environment preparation: First, we need to build J

How to solve the problem if Dreamweaver fails to install php7.0 How to solve the problem if Dreamweaver fails to install php7.0 Mar 23, 2023 am 11:11 AM

It is a common situation to encounter problems when installing Dreamweaver. One of the possible problems is that php7.0 cannot be successfully installed. In this article, we will explain how to solve this problem.

See all articles