public function post(
            $body,
            int $timeout = 30,
            $version = HttpVersion::HTTP_1_1
    ): HttpResponse {
        if (is_array($body)) {
            $body = $this->transformPostValues($body);
            $this->headers->put('Content-Type', 'application/x-www-form-urlencoded');
        }

        $this->headers->put('Content-Length', strlen($body));
        $socket = $this->httpUri->openSocket($timeout);
        $this->processHeader($socket, Http::POST, $version);
        $socket->write($body);
        return HttpResponse::create($socket);
    }
public function post(
            $body,
            int $timeout = 30,
            $version = HttpVersion::HTTP_1_1
    ): HttpResponse {
        if (is_array($body)) {
            $body = $this->transformPostValues($body);
            $this->headers->put('Content-Type', 'application/x-www-form-urlencoded');
        }

        $this->headers->put('Content-Length', strlen($body));
        $socket = $this->httpUri->openSocket($timeout);
        $this->processHeader($socket, Http::POST, $version);
        $socket->write($body);
        return HttpResponse::create($socket);
    }
public function post ( $ body , int $ timeout = 30 , $ version = HttpVersion :: HTTP_1_1 ) : HttpResponse { if ( is_array ( $ body ) ) { $ body = $ this -> transformPostValues ( $ body ) ; $ this -> headers -> put ( 'Content-Type' , 'application/x-www-form-urlencoded' ) ; } $ this -> headers -> put ( 'Content-Length' , strlen ( $ body ) ) ; $ socket = $ this -> httpUri -> openSocket ( $ timeout ) ; $ this -> processHeader ( $ socket , Http :: POST , $ version ) ; $ socket -> write ( $ body ) ; return HttpResponse :: create ( $ socket ) ; }
initializes a post request

The body can either be given as string or as array, which is considered
to be a map of key-value pairs denoting post request parameters. If the
latter is the case an post form submit content type will be added to the
request.

@param   string|array                            $body     post request body
@param   int                                     $timeout  optional  connection timeout, defaults to 30 seconds
@param   string|\stubbles\peer\http\HttpVersion  $version  optional  http version, defaults to HTTP/1.1
@return  \stubbles\peer\http\HttpResponse
initializes a post request