public function post($command, $params = null, $postcontenttype = 'application/json')
    {
        $url = $command;

        $headers = array('Content-Type' => $postcontenttype);

        $content = $params;
        if ($postcontenttype == 'application/json') {
            $content = json_encode($params);
        }

        try {
            $response = $this->client->post($url, ['headers' => $headers, 'body' => $content]);
        } catch (\Exception $e) {
            return null;
        }
        $this->checkError($response, $url);

        return $response->getBody();
    }
public function post($command, $params = null, $postcontenttype = 'application/json')
    {
        $url = $command;

        $headers = array('Content-Type' => $postcontenttype);

        $content = $params;
        if ($postcontenttype == 'application/json') {
            $content = json_encode($params);
        }

        try {
            $response = $this->client->post($url, ['headers' => $headers, 'body' => $content]);
        } catch (\Exception $e) {
            return null;
        }
        $this->checkError($response, $url);

        return $response->getBody();
    }
public function post ( $ command , $ params = null , $ postcontenttype = 'application/json' ) { $ url = $ command ; $ headers = array ( 'Content-Type' => $ postcontenttype ) ; $ content = $ params ; if ( $ postcontenttype == 'application/json' ) { $ content = json_encode ( $ params ) ; } try { $ response = $ this -> client -> post ( $ url , [ 'headers' => $ headers , 'body' => $ content ] ) ; } catch ( \ Exception $ e ) { return null ; } $ this -> checkError ( $ response , $ url ) ; return $ response -> getBody ( ) ; }
Perform a post request.

@param string     $command         The command to execute.

@param null|array $params          The parameters to use.

@param string     $postcontenttype The content type of the POST data.

@return StreamInterface|null|string
Perform a post request .