百度实时推送api接口应用示例_PHP
网站质量不错的网站可以在百度站长平台/数据提交/sitemap栏目下看到实时推送的功能, 目前这个工具是邀请开放, 百度的实时推送的api接口可以实时推送我们新发布的文章, 保证百度在第一时间收录.
百度站长平台 http://zhanzhang.baidu.com/
打开百度站长平台, 点开实时推送的添加新数据接口获得带token的api推送地址:
http://ping.baidu.com/sitemap?site=www.yourdomain.com&resource_name=sitemap&access_token=xxxxxxx
分享一段网友写的php实时推送代码:
php 实时推送新发布的文章
socketopen方式推送sitemap
代码如下:
function sitemap_ping_baidu($urls){
$baidu_ping_url = 'ping.baidu.com';
$get = '/sitemap?site=www.yourdomain.com&resource_name=sitemap&access_token=xxxxxxx';
$port=80;
if ( ( $io = fsockopen( $baidu_ping_url, $port, $errno, $errstr, 50 ) ) !== false ) {
$send = "POST $get HTTP/1.1"."rn";
$send .= 'Accept: */*'."rn";
$send .= 'Cache-Control: no-cache'."rn";
$send .= 'Host: '.$baidu_ping_url."rn";
$send .= 'Pragma: no-cache'."rn";
//$send .= "Referer: http://".$url.$get."rn";
//$send .= 'User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)'."rn";
$xml = '
foreach($urls as $url){
$xml .= '
$xml .= '
$xml .= '
$xml .= '
$xml .= '
$xml .= '
}
$xml .= '
$send .= 'Content-Length:'.strlen($xml)."rn";
$send .= "Connection: Closernrn";
$send .= $xml."rn";
fputs ( $io, $send );
$return = '';
while ( ! feof ( $io ) )
{
$return .= fread ( $io, 4096 );
}
return $return;
}else{
return false;
}
}
$return = sitemap_ping_baidu(array('http://www.yourdomain.com/a.php?id=1'));
推送后百度会返回的xml文档
代码如下:
状态码含义如下
200 | 无使用方式错误,需要进一步观察返回的内容是否正确 |
400 | 必选参数未提供 |
405 | 不支持的请求方式,我们只支持POST方式提交数据 |
411 | HTTP头中缺少Content-Length字段 |
413 | 推送的数据过大,超过了10MB的限制 |
422 | HTTP头中Content-Length声明的长度和实际发送的数据长度不一致 |
500 | 站长平台服务器内部错误 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to skip security warnings in Baidu? There are various security protection services in Baidu APP, but most friends don’t know how to skip security warnings. Next, the editor brings to users pictures and texts on how to skip security warnings in Baidu. Tutorial, interested users come and take a look! How to skip security warnings in Baidu 1. First open Baidu APP, enter the lower right corner of the main page, click [My], and click [Settings] in the upper right corner of the My area; 2. Then on the settings function page, select [Internet Security]; 3. Finally, on the Internet security interface, click [Website Security] to skip the complete warning.

How to use Baidu Advanced Search Baidu search engine is currently one of the most commonly used search engines in China. It provides a wealth of search functions, one of which is advanced search. Advanced search can help users search for the information they need more accurately and improve search efficiency. So, how to use Baidu advanced search? The first step is to open the Baidu search engine homepage. First, we need to open Baidu’s official website, which is www.baidu.com. This is the entrance to Baidu search. In the second step, click the Advanced Search button. On the right side of the Baidu search box, there is

Editor of Machine Power Report: Wu Xin The domestic version of the humanoid robot + large model team completed the operation task of complex flexible materials such as folding clothes for the first time. With the unveiling of Figure01, which integrates OpenAI's multi-modal large model, the related progress of domestic peers has been attracting attention. Just yesterday, UBTECH, China's "number one humanoid robot stock", released the first demo of the humanoid robot WalkerS that is deeply integrated with Baidu Wenxin's large model, showing some interesting new features. Now, WalkerS, blessed by Baidu Wenxin’s large model capabilities, looks like this. Like Figure01, WalkerS does not move around, but stands behind a desk to complete a series of tasks. It can follow human commands and fold clothes

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

Baidu Incognito Mode is a privacy protection feature that allows users to use Baidu search or other services without leaving any personal information or browsing history. For some users, they may want to turn off incognito mode so that they can keep their search history or browsing history. So how to release Baidu incognito mode? Friends who are still unclear, don’t worry. Next, the editor will bring you a method to remove the incognito browsing mode. You can follow the steps below. How to release Baidu incognito mode 1. Click the [Baidu] icon on the desktop to open the Baidu APP. 2. Search for something and enter the search results page. 3. Click [≡] at the bottom of the page. 4. Find "Multi-Window" in the pop-up window and click to enter. 5. Turn on/off "Incognito"

API interface types are rich and diverse, including RESTful API, SOAP API, GraphQL API, etc. RESTful API communicates through the HTTP protocol, with a simple and efficient design, which is the current mainstream Web API design style. SOAP API is based on XML, focuses on cross-language and platform interoperability, and is mostly used in large enterprises and government agencies. GraphQL API is a new query language and runtime environment that supports flexible data query and response.

There are many users in Xirang who don’t know where the shells are and how to get them. Some players have been searching for several hours but still can’t find them. Below, the editor will introduce how to obtain Baidu Xirang shells. Come and take a look. . How to get Baidu Xirang Shell 1. First we need to come to the community, and then come to the location in the picture below. 2. Select the destination here and choose to enter the 188th floor. 3. After entering the 188th floor, you will see this prompt when walking around. Just click I Got It. 4. The location of the shell may be a little difficult to find. Just behind the 188 elevator, there is a small glowing dot that is the shell. 5. You need to use a VR controller to pick up shells. Just click on the shell. Redemption method 1. First click the "Settings" icon in the upper right corner of the page and select "

On May 15, Baidu Apollo held Apollo Day 2024 in Wuhan Baidu Luobo Automobile Robot Zhixing Valley, comprehensively demonstrating Baidu's major progress in autonomous driving over the past ten years, bringing technological leaps based on large models and a new definition of passenger safety. With the world's largest autonomous vehicle operation network, Baidu has made autonomous driving safer than human driving. Thanks to this, safer, more comfortable, green and low-carbon travel methods are turning from ideal to reality. Wang Yunpeng, vice president of Baidu Group and president of the Intelligent Driving Business Group, said on the spot: "Our original intention to build autonomous vehicles is to satisfy people's growing yearning for better travel. People's satisfaction is our driving force. Because safety, So beautiful, we are happy to see
