采集

2019-08-23  本文已影响0人  小进我是爸爸

namespace app\index\controller;

use think\Controller;

use QL\QueryList;

use GuzzleHttp;

class Index extends  Controller

{

    public function index()

{

$rules = array (

    'title' =>

        array (

            0 => 'h3>a',

            1 => 'text',

        ),

    'link' =>

        array (

            0 => 'h3>a',

            1 => 'href',

        ),

);

$data = QueryList::get('https://baowen.xhh.com/manage/baijia/article',[

    'start'=>'2019-08-23 00:00',

    'sort'=>'pv',

    'page'=>2

],[

    'headers'=>[

    'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',

    'Referer'=>'https://baowen.xhh.com/manage',

    'Host'=>'baowen.xhh.com',

    'Cookie'=>'',

    'Connection'=>'keep-alive',

    'Cache-Control'=>'max-age=0',

    'Accept-Language'=>'zh-CN,zh;q=0.9',

    'Accept-Encoding'=>'gzip, deflate, br',

    'Accept'=>'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'

    ]

]);

        $rules = array (

            'title' =>

                array (

                    0 => 'copy_url',

                    1 => 'text',

                ),

            'link' =>

                array (

                    0 => '.my_tooltip',

                    1 => 'href',

                ),

        );

        $rt = $data->rules($rules)->queryData();

        var_dump($rt);die;

        $data = QueryList::html($html)->find('h3')->texts();

        return $this->fetch();

    }

    //

    public function add_article(){

        return $this->fetch('add_article');

    }

}

上一篇 下一篇

猜你喜欢

热点阅读