In the current PHP documentation or elsewhere, I could not find anything about HTTP protocol version 2 when creating a stream context.
Is the usage transparent, or must special features of HTTP/2 be taken into account? Does the use of HTTP/2 in the context of streams make any sense?
I am aware that CURL would handle all this for me - but I do not want to use CURL.
Here is a small example with FOPEN:
$context = [
"http" => [
"header" => [
"Accept-encoding: gzip, deflate",
"Connection: close",
"Upgrade-insecure-requests: 1",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Dnt: 1",
"Accept-language: en-us",
"Content-type: text/html"
],
"ignore_errors" => true,
"max_recirects" => 3,
"method" => "POST",
"protocol_version" => 2.0,
"timeout" => 30.0,
"content" => ""
],
"ssl" => [
"disable_compression" => false,
"verify_peer" => true,
"verify_depth" => 5,
"SNI_enabled" => true
]
];
$stream = stream_context_create($context);
$result = fopen(base64_decode(self::URL), "rb", false, $stream);