JasonLewis Posted July 13, 2010 Share Posted July 13, 2010 I'm curious as to how reliable some of the $_SERVER elements are, mainly the ones related to the URI and Query String. What I'm doing is building a query string using $_SERVER['QUERY_STRING'], however I'm unsure of how reliable it is I am aware that a few of the elements in the predefined variable can be unreliable, but what about the QUERY_STRING element? Cheers. Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted July 13, 2010 Share Posted July 13, 2010 What you see is what you get on this var. Every http server needs a request uri. Therefor it will be populated in every condition except one: When a PHP script is run from a command line or similar. Although I'm pretty sure this variable still populates even under those circumstances. -cb- Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted July 13, 2010 Share Posted July 13, 2010 The $_SERVER vars are populated by the webserver, not PHP, so they are implementation dependent. Take a look at the cgi spec. I would assume that all of these will be implemented by modern webservers: http://web.archive.org/web/20071018185254/http://hoohoo.ncsa.uiuc.edu/cgi/env.html Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted July 13, 2010 Author Share Posted July 13, 2010 The $_SERVER vars are populated by the webserver, not PHP, so they are implementation dependent. Take a look at the cgi spec. I would assume that all of these will be implemented by modern webservers: http://web.archive.org/web/20071018185254/http://hoohoo.ncsa.uiuc.edu/cgi/env.html Well, according to that page in regards to QUERY_STRING: This variable should always be set when there is query information, regardless of command line decoding. Very good. Thanks for that link. Thanks for your time guys. Appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.