Forum Moderators: coopster

Message Too Old, No Replies

Why HTTP Header does not show correct value?

         

toplisek

7:34 pm on Jan 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have code like.
$accept_charset = $_SERVER["HTTP_ACCEPT_CHARSET"]

Why is this value not as posted on my website in meta?

g1smd

11:58 pm on Jan 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That variable comes from the user's browser.

It is the character set that their browser accepts.

toplisek

7:26 am on Jan 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



how to read than what is on particular website encoding? Is this possible to be achieved?

coopster

7:02 pm on Jan 27, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



As mentioned, it is not the website encoding that you will find in that variable. The $_SERVER superglobal name can be a little misleading here. Just because it is named "$_SERVER" does not mean that it holds server configuration information. The http server has read that information from the user agent (browser). The user's browser sends certain information regarding requests made to servers and the server reads that information to determine how to respond to the request.

A bit of background can be gained by reading the Apache content negotiation [httpd.apache.org] manual page and if you really feel up to some hardcore reading, pull RFC2616 and dig in.