PHP code example of wangqs / querylist-rule-baidu-news

1. Go to this page and download the library: Download wangqs/querylist-rule-baidu-news 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/ */

    

wangqs / querylist-rule-baidu-news example snippets


use QL\QueryList;
use QL\Ext\BaiduNews;

$ql = QueryList::getInstance();
$ql->use(BaiduNews::class);
//or Custom function name
$ql->use(BaiduNews::class,'baidu');

$baiduNews = $ql->baiduNews(10)
$searcher = $baiduNews->search('QueryList');
$count = $searcher->getCount();
$data = $searcher->page(1);
$data = $searcher->page(2);

$searcher = $baiduNews->search('php');
$countPage = $searcher->getCountPage();
for ($page = 1; $page <= $countPage; $page++)
{
    $data = $searcher->page($page);
}

$searcher = $ql->baiduNews()->search('QueryList');
$data = $searcher->setHttpOpt([
    // Set the http proxy
    'proxy' => 'http://222.141.11.17:8118',
   // Set the timeout time in seconds
    'timeout' => 30,
])->page(1);