-
-
Notifications
You must be signed in to change notification settings - Fork 442
API QueryList
Jaeger edited this page Oct 8, 2017
·
9 revisions
Class QueryList
- Class name: QueryList
- Namespace: QL
mixed QL\QueryList::__construct()
QueryList constructor.
- Visibility: public
\QL\QueryList QL\QueryList::getInstance()
Get the QueryList instance
- Visibility: public
- This method is static.
null|\QL\Config QL\QueryList::config()
Get the Config instance
- Visibility: public
- This method is static.
mixed QL\QueryList::destruct()
Destruction of resources
- Visibility: public
\QL\QueryList QL\QueryList::bind(string $name, \Closure $provide)
Bind a custom method to the QueryList object
- Visibility: public
- $name string - <p>Invoking the name</p>
- $provide Closure - <p>Called method</p>
QL\QueryList::getHtml()
- Visibility: public
\QL\QueryList QL\Dom\Query::setHtml($html, null $charset)
- Visibility: public
- $html mixed
- $charset null
QL\QueryList::html($html, null $charset)
Set html,see setHtml()
.
- Visibility: public
- $html mixed
- $charset null
\QL\Dom\Elements QL\Dom\Query::find($selector)
Searches for all elements that match the specified expression.
- Visibility: public
- $selector mixed - A string containing a selector expression to match elements against.
\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
- $rules array
\QL\QueryList QL\Dom\Query::range($selector)
Set the slice area for crawl list
- Visibility: public
- $selector mixed
\QL\QueryList QL\Dom\Query::removeHead()
Remove HTML head,try to solve the garbled
- Visibility: public
\QL\QueryList QL\Dom\Query::query(\Closure|null $callback)
Execute the query rule
- Visibility: public
- $callback Closure|null
\Illuminate\Support\Collection|static QL\Dom\Query::getData(\Closure|null $callback)
Get crawl results
- Visibility: public
- $callback Closure|null
mixed QL\Dom\Query::setData(\Illuminate\Support\Collection $data)
- Visibility: public
- $data Illuminate\Support\Collection
QL\QueryList::encoding(string $outputEncoding,string $inputEncoding = null)
Encoding of html to solve the problem of distortion.
- Visibility: public
QL\QueryList::get($url,$args = null,$otherArgs = [])
Http get.see GuzzleHttp
- Visibility: public
- $url string
- $args array|string url params
- $otherArgs array GuzzleHttp options
QL\QueryList::post()
Http post.see GuzzleHttp
- Visibility: public
- $url string
- $args array post data
- $otherArgs array GuzzleHttp options
QL\QueryList::use($plugins,…$opt)
Install the plugin.
- Visibility: public
- $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.