I'm trying to send data on body, using put request with Guzzle. How can I write data to body, similar to this read command of get message?
while (!$body->eof())
{
$data = $body_origin->read(1024*1024);
}
Something i tried:
$dest_stream = Psr7\Utils::streamFor();
$response_dest = $client_destination->request('PUT', $url_dest,
[
'stream' => true,
'body' => $dest_stream,
'read_timeout' => 100,
'Content-Type' => 'application/octet-stream',
'headers' =>
[
'Content-Length' => '0'
]
]);
while (!$data_to_send->eof())
{
$data = $data_to_send->read(1024*1024);
$dest_stream->write($data);
}