属性列表

errCode

类型为int型。当connect/send/recv/close失败或者超时时,会自动设置Swoole\Coroutine\Http\Client->errCode的值。
errCode的值等于Linux errno。可使用socket_strerror将错误码转为错误信息。

echo socket_strerror($client->errCode);

附录:Linux的errno定义

body

存储上次请求的返回包体

$cli = new Swoole\Coroutine\Http\Client('127.0.0.1', 80);
$cli->get('/index.php');
echo $cli->body;
$cli->close();

statusCode

Http状态码,如200404等。状态码如果为负数,表示连接存在问题。