Getting Status Code and Server Type with PHP
What is Server Status Code?
A status code is a number and a label, like "404 Not Found"
and "500 Internal Server Error."
What is Server Type?
The server type (the server operating system) is the software being used and, sometimes,
a list of helper software.
Useful Software
That information can useful while testing software. Knowing
the server type where a client's domain is on can be useful
when recommending software.
Do you use .htaccess or other methods to redirect certain
web pages? Use this software to verify things are working as
they should. For example, if you enter "willmaster.com",
you'll see both "301 Moved Permanently" and
"Location: /". If you then enter
"www.willmaster.com", you'll see a "200 OK" status.
How To Read the Web Page Header Information
The status code is on the first line of the information the
server provides. Other information follows.
And, of course, it can also be good to see what others can
see about our own servers, should they be inclined to snoop.
Determining Server Operating System
We use a version of the PHP server snooper software
presented in this article to let customers test their own
server to see if they meet operating system requirements.
The checker is on the software description pages.
If you want to see how one works, a server type checker is
on the Master Form V4 description page. Give it a spin.
Viewing Actual Redirect Status Code
Many hosting accounts are configured to redirect to a
different web page when certain errors are found, like the
"500." The PHP server snooper script with this article lets
you see that real error code regardless which web page the
hosting account is configured to display instead.
Independently obtaining a status code can be a real time
saver when installing software and the server keeps spawning
errors. You know what the real error code is, not just a
redirect page.
Copy 'n Paste PHP Script
The PHP script that comes with this article is complete.
There is nothing to add or remove or customize. Copy 'n
paste.
Here is the PHP server snooper script:
The PHP server snooper source code is provided as a complete
web page. Upload it to your server and you're good to go. To
use the software, type its URL into your browser.
If you scan the code, you'll see it has the beginning and
ending marked should you wish to transfer the software to
one of your existing PHP web pages. Copy the code between
those marks and paste it where it is to be used.
PHP Server Snooper Software Installed and Ready To Use
If you prefer not to install your own, server snooper
software is installed and available for your use.
Will Bontrager
©Copyright 2008 Bontrager Connection, LLC Bontrager Connection, LLC
Please note:
Articles on this website are presented "as is". However -
If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Ask one of our Experts and you'll have your answer!
Click here for details.