You are here

protected function Salesforce::httpRequest in Salesforce Suite 7.3

Make the HTTP request. Wrapper around drupal_http_request().

Parameters

string $url: Path to make request from.

array $data: The request body.

array $headers: Request headers to send as name => value.

string $method: Method to initiate the call, such as GET or POST. Defaults to GET.

Return value

object Salesforce response object.

4 calls to Salesforce::httpRequest()
Salesforce::apiHttpRequest in includes/salesforce.inc
Private helper to issue an SF API request.
Salesforce::refreshToken in includes/salesforce.inc
Refresh access token based on the refresh token. Updates session variable.
Salesforce::requestToken in includes/salesforce.inc
OAuth step 2: Exchange an authorization code for an access token.
Salesforce::setIdentity in includes/salesforce.inc
Retrieve and store the Salesforce identity given an ID url.

File

includes/salesforce.inc, line 225
Objects, properties, and methods to communicate with the Salesforce REST API

Class

Salesforce
Ability to authorize and communicate with the Salesforce REST API.

Code

protected function httpRequest($url, $data, $headers = array(), $method = 'GET') {

  // If method is GET, data should not be sent otherwise drupal_http_request()
  // will set Content-Length header which confuses some proxies like Squid.
  if ($method === 'GET') {
    $data = NULL;
  }

  // Build the request, including path and headers. Internal use.
  $options = array(
    'method' => $method,
    'headers' => $headers,
    'data' => $data,
  );
  return drupal_http_request($url, $options);
}