public function post($uri, $bodyJSON, array $options = [], $usePromises = false)
    {
        $headers = [];
        if (!empty($options["headers"]))
            $headers = $options["headers"];

        // overwrite mandatory headers
        if (is_string($bodyJSON)){
            $headers["Content-Length"] = strlen($bodyJSON);
        }

        // get generic headers
        $headers = $this->normalizeHeaders($headers);

        // prepare guzzle request options
        $options = [
            "headers" => $headers,
            "json" => $bodyJSON,
        ];

        $client  = new Client(["base_uri" => $this->getBaseUrl()]);

        if (! $usePromises) {
            // return the response object when the request is completed.
            // this behaviour handles the request synchronously.
            return $client->request('POST', $uri, $options);
            //XXX return $response->getBody()->getContents();
        }

        return $this->promiseResponse($client, $request, $options);
    }
public function post($uri, $bodyJSON, array $options = [], $usePromises = false)
    {
        $headers = [];
        if (!empty($options["headers"]))
            $headers = $options["headers"];

        // overwrite mandatory headers
        if (is_string($bodyJSON)){
            $headers["Content-Length"] = strlen($bodyJSON);
        }

        // get generic headers
        $headers = $this->normalizeHeaders($headers);

        // prepare guzzle request options
        $options = [
            "headers" => $headers,
            "json" => $bodyJSON,
        ];

        $client  = new Client(["base_uri" => $this->getBaseUrl()]);

        if (! $usePromises) {
            // return the response object when the request is completed.
            // this behaviour handles the request synchronously.
            return $client->request('POST', $uri, $options);
            //XXX return $response->getBody()->getContents();
        }

        return $this->promiseResponse($client, $request, $options);
    }
public function post ( $ uri , $ bodyJSON , array $ options = [ ] , $ usePromises = false ) { $ headers = [ ] ; if ( ! empty ( $ options [ "headers" ] ) ) $ headers = $ options [ "headers" ] ; // overwrite mandatory headers if ( is_string ( $ bodyJSON ) ) { $ headers [ "Content-Length" ] = strlen ( $ bodyJSON ) ; } // get generic headers $ headers = $ this -> normalizeHeaders ( $ headers ) ; // prepare guzzle request options $ options = [ "headers" => $ headers , "json" => $ bodyJSON , ] ; $ client = new Client ( [ "base_uri" => $ this -> getBaseUrl ( ) ] ) ; if ( ! $ usePromises ) { // return the response object when the request is completed. // this behaviour handles the request synchronously. return $ client -> request ( 'POST' , $ uri , $ options ) ; //XXX return $response->getBody()->getContents(); } return $ this -> promiseResponse ( $ client , $ request , $ options ) ; }
This method triggers a POST request to the given
URI using the GuzzleHttp client.

@todo Implement POST Promises features
@see  \NEM\Contracts\RequestHandler
@param  string $uri
@param  string $bodyJSON
@param  array  $options
@param  boolean  $synchronous
@return [type]
This method triggers a POST request to the given URI using the GuzzleHttp client .