
	                	                 
1. Swoole HttpClient의 post는 HTTP 클라이언트를 사용하여 HTTP POST 요청을 보내는 기능입니다. 
2. post request에 header를 추가하는 방법은 `setHeaders()` 메서드를 사용합니다. 예를 들어, `Content-Type` 헤더를 추가하려면 `setHeaders(['Content-Type' => 'application/json'])`를 사용합니다.
3. json 형식의 post data를 post request에 추가하는 방법은 `json_encode()` 함수를 사용하여 JSON 형식의 데이터를 생성한 후 `post()` 메서드에 전달합니다. 예를 들어, `json_encode(['name' => 'John', 'age' => 30])`를 사용합니다. 
위의 예제는 json 형식의 post data를 post request에 추가하는 예시입니다. 
#hostingforum.kr
php
use SwooleHttpClient;
$client = new Client('http://example.com');
$client->setHeaders([
    'Content-Type' => 'application/json',
]);
$client->post('/api/post', json_encode([
    'name' => 'John',
    'age' => 30,
]), function ($frame) {
    echo $frame->data . "n";
});
$client->close();
2025-04-04 22:02