public function sendRequest($url, $params, $method)
    {
        try{
            if (!empty($params['html'])){
                $commandName = 'GenerateFromHTML';
            }
            else if (!empty($params['url'])){
                $commandName = 'GenerateFromURL';
            }
            else if (!empty($params['file'])&& $url=='pdf'){
                $commandName = 'GenerateFromFile';
            }
            else {
                $operations = $this->getDescription()->getOperations();
                foreach ($operations as $operation)
                {
                    if ($operation->getUri()==$url && $operation->getHttpMethod() == $method)
                    {
                        $commandName = $operation->getName();
                    }
                }
            }
            $command = $this->getCommand($commandName, $params);
            $ret = $this->execute($command);

            if ( $commandName == 'GetAssetList' || $commandName == 'UploadAsset' )
            {
                return json_encode($ret);
            }
            return $ret->getBody(true);

        }catch(ClientErrorResponseException $exception){
            throw new \Exception($exception->getResponse()->getBody(true), $exception->getResponse()->getStatusCode());
        }
    }
public function sendRequest($url, $params, $method)
    {
        try{
            if (!empty($params['html'])){
                $commandName = 'GenerateFromHTML';
            }
            else if (!empty($params['url'])){
                $commandName = 'GenerateFromURL';
            }
            else if (!empty($params['file'])&& $url=='pdf'){
                $commandName = 'GenerateFromFile';
            }
            else {
                $operations = $this->getDescription()->getOperations();
                foreach ($operations as $operation)
                {
                    if ($operation->getUri()==$url && $operation->getHttpMethod() == $method)
                    {
                        $commandName = $operation->getName();
                    }
                }
            }
            $command = $this->getCommand($commandName, $params);
            $ret = $this->execute($command);

            if ( $commandName == 'GetAssetList' || $commandName == 'UploadAsset' )
            {
                return json_encode($ret);
            }
            return $ret->getBody(true);

        }catch(ClientErrorResponseException $exception){
            throw new \Exception($exception->getResponse()->getBody(true), $exception->getResponse()->getStatusCode());
        }
    }
public function sendRequest ( $ url , $ params , $ method ) { try { if ( ! empty ( $ params [ 'html' ] ) ) { $ commandName = 'GenerateFromHTML' ; } else if ( ! empty ( $ params [ 'url' ] ) ) { $ commandName = 'GenerateFromURL' ; } else if ( ! empty ( $ params [ 'file' ] ) && $ url == 'pdf' ) { $ commandName = 'GenerateFromFile' ; } else { $ operations = $ this -> getDescription ( ) -> getOperations ( ) ; foreach ( $ operations as $ operation ) { if ( $ operation -> getUri ( ) == $ url && $ operation -> getHttpMethod ( ) == $ method ) { $ commandName = $ operation -> getName ( ) ; } } } $ command = $ this -> getCommand ( $ commandName , $ params ) ; $ ret = $ this -> execute ( $ command ) ; if ( $ commandName == 'GetAssetList' || $ commandName == 'UploadAsset' ) { return json_encode ( $ ret ) ; } return $ ret -> getBody ( true ) ; } catch ( ClientErrorResponseException $ exception ) { throw new \ Exception ( $ exception -> getResponse ( ) -> getBody ( true ) , $ exception -> getResponse ( ) -> getStatusCode ( ) ) ; } }
Sends the request via Guzzle Client

@param string $url       Relative url for the request
@param array $params     Parameters for the request
@param string $method    Method for the request
@return string           Response body
@throws \Exception
Sends the request via Guzzle Client