public function RestClient::httpRequestRaw in Salesforce Suite 8.3
Same name and namespace in other branches
- 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequestRaw()
- 5.0.x src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequestRaw()
Return raw response content from given URL.
Useful for fetching data from binary fields like Attachments.
Parameters
string $url: The url to request.
Return value
mixed The raw http response body.
Throws
\Exception
Overrides RestClientInterface::httpRequestRaw
File
- src/
Rest/ RestClient.php, line 249
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
public function httpRequestRaw($url) {
if (!$this
->getAccessToken()) {
throw new \Exception('Missing OAuth Token');
}
$headers = [
'Authorization' => 'OAuth ' . $this
->getAccessToken(),
'Content-type' => 'application/json',
];
$response = $this
->httpRequest($url, NULL, $headers);
return $response
->getBody()
->getContents();
}