I'm trying to use get the response headers using PHP.
Here's my current code:
foreach ($headers as $name => $value) {
foreach ($value as $key => $moreinfo) {
echo "$name === $moreinfo \n";
}
}
I basically just don't want there to be multiple $name
entries.
For example, I'm currently seeing this being echoed:
date === Sun, 03 Nov 2019 03:03:11 GMT
date === Sun, 03 Nov 2019 03:03:11 GMT
via === 1.1 varnish
via === 1.1 varnish
connection === keep-alive
x-served-by === cache-bur17530-BUR
x-served-by === cache-bur17548-BUR
I would want it changed to just showing this:
date === Sun, 03 Nov 2019 03:03:11 GMT
via === 1.1 varnish
connection === keep-alive
x-served-by === cache-bur17548-BUR
Is there anything that could just be modified in the foreach
to make this happen?