update README

This commit is contained in:
Jaeger 2017-10-08 22:48:06 +08:00
parent a0f7b9aa3e
commit a4d0087e47
2 changed files with 4 additions and 2 deletions

View File

@ -131,7 +131,7 @@ QueryList::get('https://top.etao.com')->encoding('UTF-8','GB2312')->find('a')->t
QueryList::get('https://top.etao.com')->encoding('UTF-8')->find('a')->texts(); QueryList::get('https://top.etao.com')->encoding('UTF-8')->find('a')->texts();
``` ```
#### HTTP网络操作 #### HTTP网络操作GuzzleHttp
- 携带cookie登录新浪微博 - 携带cookie登录新浪微博
```php ```php
//采集新浪微博需要登录才能访问的页面 //采集新浪微博需要登录才能访问的页面
@ -217,6 +217,7 @@ $ql = QueryList::getInstance();
//绑定一个myHttp方法到QueryList对象 //绑定一个myHttp方法到QueryList对象
$ql->bind('myHttp',function ($url){ $ql->bind('myHttp',function ($url){
// $this 为当前的QueryList对象
$html = file_get_contents($url); $html = file_get_contents($url);
$this->setHtml($html); $this->setHtml($html);
return $this; return $this;

View File

@ -130,7 +130,7 @@ QueryList::get('https://top.etao.com')->encoding('UTF-8','GB2312')->find('a')->t
QueryList::get('https://top.etao.com')->encoding('UTF-8')->find('a')->texts(); QueryList::get('https://top.etao.com')->encoding('UTF-8')->find('a')->texts();
``` ```
#### HTTP Client #### HTTP Client (GuzzleHttp)
- Carry cookie login GitHub - Carry cookie login GitHub
```php ```php
//Crawl GitHub content //Crawl GitHub content
@ -216,6 +216,7 @@ $ql = QueryList::getInstance();
//Bind a `myHttp` method to the QueryList object //Bind a `myHttp` method to the QueryList object
$ql->bind('myHttp',function ($url){ $ql->bind('myHttp',function ($url){
// $this is the current QueryList object
$html = file_get_contents($url); $html = file_get_contents($url);
$this->setHtml($html); $this->setHtml($html);
return $this; return $this;