Batch Web Site W3C Validator
This PHP web page allows a developer to batch validate the correctness of any or all of the HTML markup, the CSS markup, and the included links of all pages on a web site, using the standard W3C validation facilities.
It assumes a web site structure where all web pages are held in pages in the top level directory (where the index page is held), or in directories subordinate to the top level.
The PHP web page should be placed in the top level directory. When invoked from the browser, it builds up a list of all files in the directory structure which are identified as being web page sources by their extension, and then proceeds to validate each one according to the user requirements. Inaccessible directories are ignored.
You can specify that you wish scanning to start from a directory subordinate to the top level, meaning that you can batch validate a subset of a web site.
The list of extensions associated with web page sources may be readily tailored, as may a list of directories to be ignored.
The display is basically a table of the URIs validated, together with the success status of the validations. It is assumed that any failure to validate will be investigated individually, and this is made easier by the status incorporating a link to the appropriate validation service. Note that the CSS validator occasionally throws up a false failure, so when the program reports a failure, the individual check may well report success.
The code uses the file_get_contents PHP function, and therefore will only work on PHP 4.3.0 and above. Some web hosting companies also prevent use of external connections through their firewall - this tends to be characterised by the program hanging. If this occurs simply terminate the page load.
Download compressed PHP file (4.52Kb)
Note: This transaction was updated on 19th September 2007 to take into account the CSS validator different reporting style.