Provides a variety of official and user-released code examples. For code reference, you are welcome to learn about Baidu/Google Ping, notification crawler crawling, second receiving is not a dream
The last time I saw an article about Ping, I used Ping in my blog. Here I overwrote the Ping class and added some configuration items in the class, makes it easier to use.
The main configuration items are:
// Ping Configuration
'Ping _ config' => array (
'Is _ PING_ON '=> 0, // whether to enable Ping; 1: Enable Ping; 0: Disable; default: Disable
'Site _ name' => 'personal website', // website NAME
'Site _ url' => 'HTTP: // www.xxx.com/', // website address
'Update _ url' => 'HTTP: // www.xxx.com/', // basic website address
'Update _ RSS_URL '=> '', // The updated Rss address cannot be blank.
),
When Ping is enabled, it is easy to use the class. You only need to input an id:
Import ('class. ping', APP_PATH); // import the Ping Class
$ Ping = new Ping (10); // input the id of the inserted article
If (! $ Ping-> google () |! $ Ping-> baidu ()){
If (! $ Ping-> google ()){
$ This-> error ('Google Ping failed ');
} Else {
$ This-> error ('Baidu Ping failed ');
}
} Else {
$ This-> success ('Ping successful ');
}
You can also set parameters when you do not set the configuration items. The usage is as follows:
Import ('class. ping', APP_PATH); // import the Ping Class
$ Param = array ('site _ name' => 'personal website', 'site _ url' => 'wei416978817 .byethost33.com/', 'id' => 10, 'updata _ rss_url '=> '');
$ Ping = new Ping ($ param );
If (! $ Ping-> google () |! $ Ping-> baidu ()){
If (! $ Ping-> google ()){
$ This-> error ('Google Ping failed ');
} Else {
$ This-> error ('Baidu Ping failed ');
}
} Else {
$ This-> success ('Ping successful ');
}
It's really easy to use! In the past, Google was always not included. I pinged it and showed the effect yesterday.
If you are free, go to http://wei416978817.byethost33.com/and give me some traffic. It's a pity .... % >_< %
Ping.class.rar (1.92 KB download: 115 times)
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB