PHP http streams default to HTTP/1.0
Today I learned the php fopen wrapper for http streams defaults to http 1.0. ☹
Thankfully you can change this default.
<?php
$context = stream_context_create(['http' =>
[
'method' => 'GET',
'header' => [
'Accept: */*',
],
'protocol_version' => 1.1
]
]);
$xml = simplexml_load_string(
file_get_contents('https://xmlstuff.example.net/cgi-mod/stats.cgi', false, $context)
);
var_export($xml);