public function execute($command, $params = null)
    {
        $url = $command;

        if (substr($url, -1) !== '/') {
            $url .= '/';
        }

        if ($params) {
            $parameters = array();
            foreach ($params as $k => $v) {
                if (strlen($v)) {
                    $parameters[] = urlencode($k) . '=' . urlencode($v);
                } else {
                    $parameters[] = urlencode($k);
                }
            }
            $url .= '?' . implode('&', $parameters);
        }

        try {
            $response = $this->client->get($url);
        } catch (\Exception $e) {
            return null;
        }
        $this->checkError($response, $url);

        return $response->getBody();
    }
public function execute($command, $params = null)
    {
        $url = $command;

        if (substr($url, -1) !== '/') {
            $url .= '/';
        }

        if ($params) {
            $parameters = array();
            foreach ($params as $k => $v) {
                if (strlen($v)) {
                    $parameters[] = urlencode($k) . '=' . urlencode($v);
                } else {
                    $parameters[] = urlencode($k);
                }
            }
            $url .= '?' . implode('&', $parameters);
        }

        try {
            $response = $this->client->get($url);
        } catch (\Exception $e) {
            return null;
        }
        $this->checkError($response, $url);

        return $response->getBody();
    }
public function execute ( $ command , $ params = null ) { $ url = $ command ; if ( substr ( $ url , - 1 ) !== '/' ) { $ url .= '/' ; } if ( $ params ) { $ parameters = array ( ) ; foreach ( $ params as $ k => $ v ) { if ( strlen ( $ v ) ) { $ parameters [ ] = urlencode ( $ k ) . '=' . urlencode ( $ v ) ; } else { $ parameters [ ] = urlencode ( $ k ) ; } } $ url .= '?' . implode ( '&' , $ parameters ) ; } try { $ response = $ this -> client -> get ( $ url ) ; } catch ( \ Exception $ e ) { return null ; } $ this -> checkError ( $ response , $ url ) ; return $ response -> getBody ( ) ; }
Execute a command on the API.

@param string        $command The command to post.

@param null|string[] $params  The parameters (if any).

@return StreamInterface|null|string
Execute a command on the API .