PHP code example of yqcode / querylist-ext-phantomjs

1. Go to this page and download the library: Download yqcode/querylist-ext-phantomjs 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/ */

    

yqcode / querylist-ext-phantomjs example snippets


$urlarr = [
    'https://mimvp.com',  // 默认 utf-8
    'https://www.qq.com', // 默认 gb2312,需添加 header,否则乱码
    'https://www.dajie.com', // content在前,name在后,匹配错误(从第一个content开始,从最后一个name结束)
    'https://m.toutiao.com',
    'https://www.baidu.com',
    'https://mp.weixin.qq.com/s/NHD6BXCbJYzl4gK-NYBKaw',
];
//插件调用
$ql = QueryList::run('PhantomJs', [
    'binpath'=>'/usr/bin/phantomjs', 
    'url'=>$urlarr[0],
    'debug'=>false
]);
//设置规则
$data = $ql->setQuery(array(
    'title' => array('title','text'),
    'keywords' => array('meta[name=keywords]','content'),
    'description' => array('meta[name=description]','content'),
    'img' => array('img','src')
))->data;
print_r($data);