清空
This commit is contained in:
-27
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Jaeger <JaegerCode@gmail.com>
|
||||
* Date: 18/12/10
|
||||
* Time: 下午4:04
|
||||
*/
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
use Jaeger\GHttp;
|
||||
|
||||
$urls = [
|
||||
'http://httpbin.org/get?name=php',
|
||||
'http://httpbin.org/get?name=go',
|
||||
'http://httpbin.org/get?name=c#',
|
||||
'http://httpbin.org/get?name=java'
|
||||
];
|
||||
|
||||
GHttp::multiRequest($urls)->withHeaders([
|
||||
'X-Powered-By' => 'Jaeger'
|
||||
])->withOptions([
|
||||
'timeout' => 10
|
||||
])->concurrency(2)->success(function($response,$index){
|
||||
print_r((String)$response->getBody());
|
||||
print_r($index);
|
||||
})->error(function($reason,$index){
|
||||
print_r($reason);
|
||||
})->get();
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Jaeger <JaegerCode@gmail.com>
|
||||
* Date: 18/12/10
|
||||
* Time: 下午6:51
|
||||
*/
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
use Jaeger\GHttp;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
|
||||
$requests = [
|
||||
new Request('POST','http://httpbin.org/post',[
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
'User-Agent' => 'g-http'
|
||||
],http_build_query([
|
||||
'name' => 'php'
|
||||
])),
|
||||
new Request('POST','http://httpbin.org/post',[
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
'User-Agent' => 'g-http'
|
||||
],http_build_query([
|
||||
'name' => 'go'
|
||||
])),
|
||||
new Request('POST','http://httpbin.org/post',[
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
'User-Agent' => 'g-http'
|
||||
],http_build_query([
|
||||
'name' => 'c#'
|
||||
]))
|
||||
];
|
||||
|
||||
GHttp::multiRequest($requests)->success(function($response,$index){
|
||||
print_r((String)$response->getBody());
|
||||
print_r($index);
|
||||
})->post();
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Jaeger <JaegerCode@gmail.com>
|
||||
* Date: 18/12/11
|
||||
* Time: 下午6:48
|
||||
*/
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
use Jaeger\GHttp;
|
||||
use Cache\Adapter\Predis\PredisCachePool;
|
||||
|
||||
|
||||
$rt = GHttp::get('http://httpbin.org/get',[
|
||||
'wd' => 'QueryList'
|
||||
],[
|
||||
'cache' => __DIR__,
|
||||
'cache_ttl' => 120
|
||||
]);
|
||||
|
||||
print_r($rt);
|
||||
|
||||
$client = new \Predis\Client('tcp:/127.0.0.1:6379');
|
||||
$pool = new PredisCachePool($client);
|
||||
|
||||
$rt = GHttp::get('http://httpbin.org/get',[
|
||||
'wd' => 'QueryList'
|
||||
],[
|
||||
'cache' => $pool,
|
||||
'cache_ttl' => 120
|
||||
]);
|
||||
|
||||
print_r($rt);
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Jaeger <JaegerCode@gmail.com>
|
||||
* Date: 18/12/11
|
||||
* Time: 下午6:48
|
||||
*/
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
use Jaeger\GHttp;
|
||||
|
||||
$rt = GHttp::get('http://httpbin.org/get',[
|
||||
'wd' => 'QueryList'
|
||||
],[
|
||||
'headers' => [
|
||||
'referer' => 'https://baidu.com',
|
||||
'User-Agent' => 'Mozilla/5.0 (Windows NTChrome/58.0.3029.110 Safari/537.36',
|
||||
'Cookie' => 'cookie xxx'
|
||||
],
|
||||
]);
|
||||
|
||||
print_r($rt);
|
||||
Reference in New Issue
Block a user