You are here

function _restclient_prepare_url_parameters in RESTClient 7.2

Encodes and appends any URL parameters to the resource path

Parameters

string $resource_path [reference]: Resource path

array $parameters [reference]: Array of URL parameters

2 calls to _restclient_prepare_url_parameters()
_restclient_request in ./restclient.module
Basic request with no body data.
_restclient_request_with_body in ./restclient.module
Requests with body data.

File

./restclient.module, line 536
Defines a standard REST interface to RESTful services

Code

function _restclient_prepare_url_parameters(&$resource_path, &$variables) {

  // URL Encode all parameters
  foreach ($variables['parameters'] as $key => $param) {
    $variables['parameters'][$key] = urlencode($param);
  }

  // Add the parameters to the resource path
  if (!empty($variables['parameters'])) {
    $resource_path = strtr($resource_path, $variables['parameters']);
  }
}