PHP code example of zyan / baidu-zz-push

1. Go to this page and download the library: Download zyan/baidu-zz-push library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zyan / baidu-zz-push example snippets


use Zyan\BaiduZzPush\BaiduZzPush;

$token = '准入密钥';

$baidu = new BaiduZzPush($token);

$baidu->push('http://www.php127.com/article/100000.html');

$urls = [
    'http://www.test.com/article/100000.html',
    'http://www.php127.com/article/100001.html'
];

$baidu->pushs($urls);

//多个站点会拆分多次推送,并反回相应站点的结果
Array
(
    [www.test.com] => Array
        (
            [error] => 401
            [message] => site error
        )

    [www.php127.com] => Array
        (
            [remain] => 99999
            [success] => 1
        )

)