/** * Submit REST Request * * @param string $method HTTP Method to use: GET or POST * @param array $params An array of parameters for the request * @param bool $process Should we convert the MARCXML? * * @return string|SimpleXMLElement The response from the XServer */ protected function call($method = 'GET', $params = null, $process = true) { if ($params) { $query = array('version=' . $this->sruVersion); foreach ($params as $function => $value) { if (is_array($value)) { foreach ($value as $additional) { $additional = urlencode($additional); $query[] = "{$function}={$additional}"; } } else { $value = urlencode($value); $query[] = "{$function}={$value}"; } } $queryString = implode('&', $query); } if ($this->debugNeeded()) { $this->debug('Connect: ' . print_r($this->host . '?' . $queryString, true)); } // Send Request $this->client->resetParameters(); $this->client->setUri($this->host . '?' . $queryString); $result = $this->client->setMethod($method)->send(); $this->checkForHttpError($result); // Return processed or unprocessed response, as appropriate: return $process ? $this->process($result->getBody()) : $result->getBody(); }