I have a function that sends requests using Symfony HTTP Client, for example, here's what that function uses to send the request:
$response = $client->request($method, $url, [
'headers' => [
'Authorization' => "Bearer $accessToken",
'Accept' => $acceptContentType,
'x-ms-client-request-id' => Traceability::getRequestId(),
...$headers,
],
'body' => $body,
'query' => $query,
'timeout' => 120
]);
This function gets passed a $body and I would like to extend this so that it can not only send strings but also binary data, if needed. Now I'm not talking about multipart/form-data but rather just putting the data in the request body like it is required for the Put Blob request in Azure Blob Storage.
Since the data to be sent is not necessarily in a file, but could be any type of resource, I decided to check if it is a resource:
if (is_resource($body)) {
}
What do I need to pass to the request function so that the Symfony client reads from the resource and sends it as request body?