发起POST
请求,函数原型:
function swoole_http2_client->post(string $path, mixed $data, callable $callback);
/index.html
,注意这里不能传入http://domain
x-www-form-urlencoded
格式的POST内容,并设置Content-Type
为application/x-www-form-urlencoded
$cli = new swoole_http2_client('127.0.0.1', 80);
$cli->post('/post.php', array("a" => '1234', 'b' => '456'), function ($response) {
echo "Length: " . strlen($cli->body) . "\n";
echo $cli->body;
});