You are here

private function ServicesClientConnectionCurlRequest::getCurlGetOptions in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_client_connection/plugins/ServicesClientConnectionCurlRequest.inc \ServicesClientConnectionCurlRequest::getCurlGetOptions()

Return the standard set of curl options for a GET

Parameters

ServicesClientConnectionHttpRequest $request: Request data that should be processed

Return value

array cURL opts array

1 call to ServicesClientConnectionCurlRequest::getCurlGetOptions()
ServicesClientConnectionCurlRequest::getCurlOptions in services_client_connection/plugins/ServicesClientConnectionCurlRequest.inc
Returns cURL opts

File

services_client_connection/plugins/ServicesClientConnectionCurlRequest.inc, line 113
Make requests via cURL

Class

ServicesClientConnectionCurlRequest
@file Make requests via cURL

Code

private function getCurlGetOptions(&$request) {

  // URL have changed to authenticate URL
  if (is_array($request->data_raw) && !empty($request->data_raw)) {
    if (strpos($request->url, '?') === FALSE) {
      $request->url .= '?' . http_build_query($request->data_raw, NULL, '&');
    }
    else {
      $request->url .= '&' . http_build_query($request->data_raw, NULL, '&');
    }
    $request->data = '';

    // Set corrent request content type
    $request->http_headers['Content-Type'] = 'application/x-www-form-urlencoded';

    // We're passing params in URL, don't indicate any content length of http request
    $request->http_headers['Content-Length'] = 0;
  }
  $ret = $this
    ->getDefaultCurlOptions($request);
  $ret += array(
    CURLOPT_BINARYTRANSFER => 1,
  );
  return $ret;
}