Skip to content

API QueryList

Jaeger edited this page Oct 8, 2017 · 9 revisions

QL\QueryList

Class QueryList

  • Class name: QueryList
  • Namespace: QL

Methods

__construct

mixed QL\QueryList::__construct()

QueryList constructor.

  • Visibility: public

getInstance

\QL\QueryList QL\QueryList::getInstance()

Get the QueryList instance

  • Visibility: public
  • This method is static.

config

null|\QL\Config QL\QueryList::config()

Get the Config instance

  • Visibility: public
  • This method is static.

destruct

mixed QL\QueryList::destruct()

Destruction of resources

  • Visibility: public

bind

\QL\QueryList QL\QueryList::bind(string $name, \Closure $provide)

Bind a custom method to the QueryList object

  • Visibility: public
Arguments
  • $name string - <p>Invoking the name</p>
  • $provide Closure - <p>Called method</p>

getHtml

 QL\QueryList::getHtml()
  • Visibility: public

setHtml

\QL\QueryList QL\Dom\Query::setHtml($html, null $charset)
  • Visibility: public
Arguments
  • $html mixed
  • $charset null

html

 QL\QueryList::html($html, null $charset)

Set html,see setHtml().

  • Visibility: public
Arguments
  • $html mixed
  • $charset null

find

\QL\Dom\Elements QL\Dom\Query::find($selector)

Searches for all elements that match the specified expression.

  • Visibility: public
Arguments
  • $selector mixed - A string containing a selector expression to match elements against.

rules

\QL\QueryList QL\Dom\Query::rules(array $rules)

Set crawl rule

$rules = [
   'rule_name1' => ['selector','HTML attribute | text | html','Tag filter list','callback'],
   'rule_name2' => ['selector','HTML attribute | text | html','Tag filter list','callback'],
   // ...
 ]
  • Visibility: public
Arguments
  • $rules array

range

\QL\QueryList QL\Dom\Query::range($selector)

Set the slice area for crawl list

  • Visibility: public
Arguments
  • $selector mixed

removeHead

\QL\QueryList QL\Dom\Query::removeHead()

Remove HTML head,try to solve the garbled

  • Visibility: public

query

\QL\QueryList QL\Dom\Query::query(\Closure|null $callback)

Execute the query rule

  • Visibility: public
Arguments
  • $callback Closure|null

getData

\Illuminate\Support\Collection|static QL\Dom\Query::getData(\Closure|null $callback)

Get crawl results

  • Visibility: public
Arguments
  • $callback Closure|null

setData

mixed QL\Dom\Query::setData(\Illuminate\Support\Collection $data)
  • Visibility: public
Arguments
  • $data Illuminate\Support\Collection

encoding

 QL\QueryList::encoding(string $outputEncoding,string $inputEncoding = null)

Encoding of html to solve the problem of distortion.

  • Visibility: public

get

 QL\QueryList::get($url,$args = null,$otherArgs = [])

Http get.see GuzzleHttp

  • Visibility: public
Arguments
  • $url string
  • $args array|string url params
  • $otherArgs array GuzzleHttp options

post

 QL\QueryList::post()

Http post.see GuzzleHttp

  • Visibility: public
Arguments
  • $url string
  • $args array post data
  • $otherArgs array GuzzleHttp options

use

 QL\QueryList::use($plugins,…$opt)

Install the plugin.

  • Visibility: public
Arguments
  • $plugins string|array Plug-in class name, or it can be an array of plug-in class names
  • …$opt mixed Multiple parameters that come with the plug-in.
Clone this wiki locally