欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

PHP如何使用QueryList輕松實(shí)現(xiàn)一個(gè)百度網(wǎng)盤(pán)資源搜索引擎

這篇文章主要介紹PHP如何使用QueryList輕松實(shí)現(xiàn)一個(gè)百度網(wǎng)盤(pán)資源搜索引擎,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

我們提供的服務(wù)有:成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)、成都外貿(mào)網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、申扎ssl等。為成百上千企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的申扎網(wǎng)站制作公司

安裝

使用Composer安裝:

安裝QueryList

composer require jaeger/querylist

GitHub: https://github.com/jae-jae/Qu...

安裝Baidu搜索引擎插件

composer require jaeger/querylist-rule-baidu

GitHub: https://github.com/jae-jae/Qu...

插件API

● Baidu baidu($pageNumber = 10):獲取百度搜索引擎

class Baidu:

● Baidu search($keyword):設(shè)置搜索關(guān)鍵詞

● Baidu setHttpOpt(array $httpOpt = []):設(shè)置HTTP選項(xiàng),查看: GuzzleHttp options

● int getCount():獲取搜索結(jié)果總條數(shù)

● int getCountPage():獲取搜索結(jié)果總頁(yè)數(shù)

● Collection page($page = 1,$realURL = false):獲取搜索結(jié)果

使用

實(shí)現(xiàn)一個(gè)百度網(wǎng)盤(pán)資源搜索引擎:

<?php
require 'vendor/autoload.php';
use QL\QueryList;
use QL\Ext\Baidu;
$ql = QueryList::use(Baidu::class);
// 搜索百度網(wǎng)盤(pán)網(wǎng)站,包含‘百度’關(guān)鍵詞的資源
$searcher = $ql->baidu()->search('site:pan.baidu.com 百度');
// 獲取第一頁(yè)數(shù)據(jù),并獲取真實(shí)URL連接地址
$data = $searcher->page(1,true);
print_r($data->all());

抓取結(jié)果:

Array
(
    [0] => Array
        (
            [title] => 百度網(wǎng)盤(pán)_享你所想
            [link] => http://pan.baidu.com/
        )
    [1] => Array
        (
            [title] => 百度網(wǎng)盤(pán) 客戶端下載
            [link] => https://pan.baidu.com/download
        )
    [2] => Array
        (
            [title] => 百度網(wǎng)盤(pán)-開(kāi)放平臺(tái)
            [link] => https://pan.baidu.com/platform/read
        )
     // ....
)

更多用法

$baidu = $ql->baidu(15); // 設(shè)置每頁(yè)搜索15條結(jié)果
$searcher = $baidu->search('QueryList');
$count = $searcher->getCount();  // 獲取搜索結(jié)果總條數(shù)
$data = $searcher->page(1);
$data = $searcher->page(2);
$searcher = $baidu->search('php');
$countPage = $searcher->getCountPage(); // 獲取搜索結(jié)果總頁(yè)數(shù)
for ($page = 1; $page <= $countPage; $page++)
{
    $data = $searcher->page($page);
}
$data = $searcher->setHttpOpt([
    // 設(shè)置http代理
    'proxy' => 'http://222.141.11.17:8118',
   // Set the timeout time in seconds
    'timeout' => 30,
])->page(1);

Google搜索引擎插件

當(dāng)然除了Baidu搜索引擎插件,QueryList也有Google搜索引擎插件,也可以實(shí)現(xiàn)同樣的功能。

GitHub: https://github.com/jae-jae/Qu...

以上是PHP如何使用QueryList輕松實(shí)現(xiàn)一個(gè)百度網(wǎng)盤(pán)資源搜索引擎的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

本文標(biāo)題:PHP如何使用QueryList輕松實(shí)現(xiàn)一個(gè)百度網(wǎng)盤(pán)資源搜索引擎
本文地址:http://chinadenli.net/article26/giojcg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、動(dòng)態(tài)網(wǎng)站、外貿(mào)建站軟件開(kāi)發(fā)、標(biāo)簽優(yōu)化、網(wǎng)頁(yè)設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)