like the title states I'm running the same script on two different PHP versions.
- My Server 1- 5.2.17
- My Server 2- 5.3.19
get_headers($url, 1);
$url was google (no www) with http and .co.uk - Or use any url that returns a 404
An example of the different outputs are:
My Server 1-
[Server] => gws
[gathered from the header]
My Server 2-
[Server] => Array [gathered from the header]
( [0] => gws [1] => gws )
What I presume is that Server 2 is following the location of a 301 and adding that to the header, where Server 1 only has the 301 header in the array.
So Server 2 would go to "http://google.co.uk" (this returns 301); and then follows it to "http://www.google.co.uk/" and adds both responses to the same output.
What my question is- what causes the change? I've checked over the PHP channel log and I can't see a mention to get_headers so I must be missing something.
If you know what causes the different outputs, and even better know how I can revert the change (without changing back to the old PHP version) I'd greatly appreciate it. I know I could use cURL but I wouldn't really want to do that.
Full-ish code (without validation etc.)
1.$address = ($_POST['address']);
2.$headerinfo = get_headers($url, 1);
$server = $headerinfo[Server];
In PHP 5.2 - if I echo $server it would be something like "Apache".
In PHP 5.3 - If I echo $server it would be "Array" (if it hits a 301).
In the end I'm planning on storing the $sever in a DB. I can't/don't want "Array" stored there.
Thanks.