


PHP implementation method of Ping service to make the website quickly included_PHP tutorial
This article continues to talk about the problem of this ping service. First, we summarize and summarize the following information:
【1】Manual Ping service address:
Baidu (Baidu) address: http://ping.baidu.com/ping .html
Google address: http://blogsearch.google.com/ping
Feedsky address: http://ping.feedsky.com/ping.html
Qihoo( Qihoo) address: http://so.blog.qihoo.com/pingblog.html
IASK (爱 Ask) address: http://blog.iask.com/ping.php
【2】Automatic Ping Service Application Programming Interface (API):
Google: http://blogsearch.google.com/ping/RPC2
Feedburner: http://ping.feedburner.com
Feedsky ): http://www.feedsky.com/api/RPC2
Feedster: http://api.feedster.com/ping.php
IASK: http://blog.iask.com /RPC2
Qihoo (Qihoo): http://ping.blog.qikoo.com/rpc2.php
Fresh fruit: http://www.xianguo.com/xmlrpc/ping.php
Catch Shrimp: http://www.zhuaxia.com/rpc/server.php
Blogdigger: http://www.blogdigger.com/RPC2
blo.gs: http://ping.blo.gs/
ICEROCKEThttp://rpc.icerocket.com:10080/
Moreover: http://api.moreover.com/RPC2
Newsgator: http://rpc.newsgator.com/
Syndic8 : http://www.syndic8.com/xmlrpc.php
Weblogs: http://rpc.weblogs.com/RPC2
Weblogalot: http://ping.weblogalot.com/rpc.php
Among the ping services provided above, I have tried some that work well and some that don’t. It depends on the situation. You can test this yourself based on the network environment, etc., and the one that suits you is the best. There is no recommendation.
Okay, having said so much above, the following is the key point, that is, how to implement the ping service. WordPress can implement it through the background, what about the others? For example, what should I do if there is a blog program that does not have a ping service function? As far as Fenren knows, the easy-to-use wordpress in the blog system comes with a PING function. There is no doubt that the ASP-like Z-BLOG seems to be able to achieve this function through a plug-in. Other blogging systems? Others? There is nothing else, my only choice is wordpress, nothing else but the only one. Haha, no kidding. Let’s talk about the problem of using PHP to implement the ping service. This is for other websites or systems that do not support the ping function. You can develop an interface to implement it yourself. For example, the secondary development of DEDECMS can be used. Fenxun has been studying this project recently.
What needs to be said is that Baidu’s ping and Google’s submission formats are different. Let’s briefly talk about them and give an introduction to Baidu and Google respectively. The first introduction is Google (why not Baidu, OK? Don’t be so entangled , there will be...):
[*1] PHP implementation of Google's ping service
For a detailed introduction to RPC, you can go to Wikipedia, the standard of Google's ping service:
RPC endpoint: http ://blogsearch.google.com/ping/RPC2
Calling method name: weblogUpdates.extendedPing
Parameters: (should be sent in the same order as listed below)
Site name
Site URL
The URL of the page that needs to be checked for updates
The URL of the corresponding RSS, RDF or Atom seed
Optional: the category name (or tag) of the page content. You can specify multiple values, separated by '|' characters.
First, write a CURL function to POST Google's RPC endpoint:
function postUrl($url, $postvar) {
$ch = curl_init();
$headers = array(
"POST ".$url." HTTP/1.0″,
"Content- type: text/xml;charset="utf-8"",
"Accept: text/xml",
"Content-length: ".strlen($postvar)
);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvar);
$res = curl_exec ($ch);
curl_close ($ch);
return $res;
}
After the main curl is written, the only thing left is to assemble the sent data according to Google’s XML-RPC standard. For detailed request examples, please refer to the official case, click here.
For example, my code is written like this:
$googleXML =
END;
$res = postUrl('http://blogsearch.google.com /ping/RPC2′, $googleXML);
//The following is the judgment of whether the return is successful or not (according to the interface description of Google ping)
if (strpos($res, "
echo "PING successful";
else
echo "PING failed";
OK, this can simply implement Google's PING service. You can modify the code to implement this function.
[*2] PHP implementation of Baidu’s ping service (this title is really DT)
Baidu’s ping service xml code is different from Google’s. Baidu always has its own characteristics:
Introduction Baidu Blog Ping Service, for a detailed introduction to Baidu Blog Ping Service, please go to: http://www.baidu.com/search/blogsearch_help.html#n7.
Baidu's ping service is also based on the XML-RPC standard protocol, but what is different from Google's ping service is that the XML format sent by Baidu's ping is different. We need to use string nodes to wrap the content.
For example:
according to For the Google interface mentioned above, we only need to change the submitted xml content. Of course, the judgment returned by Baidu ping service is also different from Google's, and corresponding modifications can also be made.
The following is the PHP code:
$baiduXML =
EOT;
$res = postUrl('http://ping.baidu.com/ping/RPC2′, $baiduXML ; "PING successful";
else
echo "PING failed";
The above code can implement PHP's ping service. Okay, now I will provide you with a Baidu ping service code. Who makes it so unique?
Copy code
function postUrl($url, $postvar)
{
$ch = curl_init();
$headers = array(
"POST ".$url." HTTP/1.0″,
"Content-type: text/xml; charset="gb2312"",
"Accept: text/xml",
"Content-length: ".strlen($postvar)
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvar);
$res = curl_exec ($ch);
curl_close ($ch);
return $res;
}
$baiduXML = "
$res = postUrl(‘http://ping.baidu.com/ping/RPC2′, $baiduXML);
if ( strpos($res, "
{
echo "PING成功";
}
else
{
echo "PING失败";
}
?>
此文很DT的让我浪费了N个草稿才写完,然后纷纭就发现需要搞个CODE的插件给WP装备上了。代码的问题真的很纠结,还有就是国人的WP主题没有支持分页的,这个让我很DT,说了半天,DT是啥?不知道……

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

Setting the httponly flag is crucial for session cookies because it can effectively prevent XSS attacks and protect user session information. Specifically, 1) the httponly flag prevents JavaScript from accessing cookies, 2) the flag can be set through setcookies and make_response in PHP and Flask, 3) Although it cannot be prevented from all attacks, it should be part of the overall security policy.

PHPsessionssolvetheproblemofmaintainingstateacrossmultipleHTTPrequestsbystoringdataontheserverandassociatingitwithauniquesessionID.1)Theystoredataserver-side,typicallyinfilesordatabases,anduseasessionIDstoredinacookietoretrievedata.2)Sessionsenhances

PHPsessionscanstorestrings,numbers,arrays,andobjects.1.Strings:textdatalikeusernames.2.Numbers:integersorfloatsforcounters.3.Arrays:listslikeshoppingcarts.4.Objects:complexstructuresthatareserialized.

TostartaPHPsession,usesession_start()atthescript'sbeginning.1)Placeitbeforeanyoutputtosetthesessioncookie.2)Usesessionsforuserdatalikeloginstatusorshoppingcarts.3)RegeneratesessionIDstopreventfixationattacks.4)Considerusingadatabaseforsessionstoragei

Session regeneration refers to generating a new session ID and invalidating the old ID when the user performs sensitive operations in case of session fixed attacks. The implementation steps include: 1. Detect sensitive operations, 2. Generate new session ID, 3. Destroy old session ID, 4. Update user-side session information.


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

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

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

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