Example #1
0
function test(Swoole\Async\HttpClient $class, $body, $header)
{
    echo $class->id . " finish\n";
    //var_dump($header);
    $class->close();
}
Example #2
0
<?php

define('DEBUG', 'on');
define('WEBPATH', dirname(__DIR__));
require WEBPATH . '/libs/lib_config.php';
$client = new Swoole\Async\HttpClient('http://127.0.0.1:8888/post.php');
$client->onReady(function ($cli, $body, $header) {
    var_dump($body, $header);
});
$client->post(array('hello' => 'world'));
$client = new Swoole\Async\HttpClient('http://www.baidu.com/');
$client->onReady(function ($cli, $body, $header) {
    var_dump($body, $header);
});
$client->get();