PHP code example of wangqs / querylist-rule-iask

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


use QL\QueryList;
use QL\Ext\Baidu;

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

$baidu = $ql->iask(10);
$searcher = $baidu->search('什么是快乐星球');
$count = $searcher->getCount();
$data = $searcher->page(1);
$data = $searcher->page(2);

$searcher = $baidu->search('什么是快乐星球');
$countPage = $searcher->getCountPage();
for ($page = 1; $page <= $countPage; $page++)
{
    $data = $searcher->page($page);
}

$searcher = $ql->baidu()->search('什么是快乐星球');
$data = $searcher->setHttpOpt([
    // Set the http proxy
    'proxy' => 'http://222.141.11.17:8118',
   // Set the timeout time in seconds
    'timeout' => 30,
])->page(1);

$baidu = $ql->baidu(3)
$searcher = $baidu->search('什么是快乐星球');

$data = $searcher->page(1);
print_r($data->all());

// Get real url
$data = $searcher->page(1,true);
print_r($data->all());