$http_response_header differs depending on OS

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thuriel
Forum Newbie
Posts: 2
Joined: Wed Feb 28, 2007 4:46 am

$http_response_header differs depending on OS

Post by thuriel »

Hi there,

I hope somebody can help me: I'm making a HTTP request to a source where I get redirected. Let's assume this page is "https://www.example.com" and it redirects me to "https://www.example.com/redirect.html". My request looks like this:

$html = file_get_contents('https://www.example.com');

Now, when I print out $http_response_headers I get different output on MacOS/Linux and Windows:

MacOS/Linux:

HTTP/1.1 302 Found
Connection: close
Date: Mon, 26 Feb 2007 15:28:46 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: /redirect.html
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 266
HTTP/1.1 200 OK
Connection: close
Date: Mon, 26 Feb 2007 15:28:46 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 7830

Windows:

HTTP/1.1 200 OK
Connection: close
Date: Mon, 26 Feb 2007 15:28:46 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 7830

So on Windows I only get the header of the last page I was redirected to. But I need all the headers on Windows.

Does anybody know which setting is responsible for that? In both cases (MacOS 10.4 and Windows XP SP2) I am using the latest XAMPP.


thuriel
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It would appear you broadcast this post in multiple boards. :lol:

Use cURL, Snoopy (or equivalent) or fsockopen() if you want more control.
thuriel
Forum Newbie
Posts: 2
Joined: Wed Feb 28, 2007 4:46 am

Post by thuriel »

Sorry, I thought the two boards I posted this to are not connected having different users.

And thank you very very much. With fsockopen() it worked quite well :)

thuriel
Post Reply