I am going to convert some file using php and send it as a part of HTTP POST request. There is part of my code:
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => "Content-type: " . $this->contentType."",
'content' => "file=".$file
)
));
$data = file_get_contents($this->url, false, $context);
Does variable $file have to be byte representation of the file which I want to send?
And is that correct way to send file in php without using form? Have you got any clues?
Also what is the way to convert file to byte representation using PHP?