public function fetch($url, $options)
    {
        $this->init();

        $request_type = $this->config->http_post === true ?
            'form_params' : 'query';
        $options = [$request_type => $options];

        try {
            $response = $this->client->request(
                $this->config->http_post === true ? 'POST' : 'GET',
                $url,
                $options
            );
        } catch (GuzzleException $exception) {
            throw new ConnectionException(
                $exception->getMessage(),
                $exception->getCode()
            );
        }

        if ($response->getStatusCode() >= 400) {
            // ccp is using error codes even if they send a valid application
            // error response now, so we have to use the content as result
            // for some of the errors. This will actually break if CCP ever uses
            // the HTTP Status for an actual transport related error.
            switch ($response->getStatusCode()) {
                case 400:
                case 403:
                case 500:
                case 503:
                    return $response->getBody()->getContents();
                    break;
            }

            throw new HTTPException(
                $response->getStatusCode(),
                $url
            );
        }

        return $response->getBody()->getContents();
    }
public function fetch($url, $options)
    {
        $this->init();

        $request_type = $this->config->http_post === true ?
            'form_params' : 'query';
        $options = [$request_type => $options];

        try {
            $response = $this->client->request(
                $this->config->http_post === true ? 'POST' : 'GET',
                $url,
                $options
            );
        } catch (GuzzleException $exception) {
            throw new ConnectionException(
                $exception->getMessage(),
                $exception->getCode()
            );
        }

        if ($response->getStatusCode() >= 400) {
            // ccp is using error codes even if they send a valid application
            // error response now, so we have to use the content as result
            // for some of the errors. This will actually break if CCP ever uses
            // the HTTP Status for an actual transport related error.
            switch ($response->getStatusCode()) {
                case 400:
                case 403:
                case 500:
                case 503:
                    return $response->getBody()->getContents();
                    break;
            }

            throw new HTTPException(
                $response->getStatusCode(),
                $url
            );
        }

        return $response->getBody()->getContents();
    }
public function fetch ( $ url , $ options ) { $ this -> init ( ) ; $ request_type = $ this -> config -> http_post === true ? 'form_params' : 'query' ; $ options = [ $ request_type => $ options ] ; try { $ response = $ this -> client -> request ( $ this -> config -> http_post === true ? 'POST' : 'GET' , $ url , $ options ) ; } catch ( GuzzleException $ exception ) { throw new ConnectionException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) ) ; } if ( $ response -> getStatusCode ( ) >= 400 ) { // ccp is using error codes even if they send a valid application // error response now, so we have to use the content as result // for some of the errors. This will actually break if CCP ever uses // the HTTP Status for an actual transport related error. switch ( $ response -> getStatusCode ( ) ) { case 400 : case 403 : case 500 : case 503 : return $ response -> getBody ( ) -> getContents ( ) ; break ; } throw new HTTPException ( $ response -> getStatusCode ( ) , $ url ) ; } return $ response -> getBody ( ) -> getContents ( ) ; }
Fetches data from api
@param string $url
@param array $options
@throws ConnectionException
@throws HTTPException
@return string
Fetches data from api