W3C Validator PHP Function
- Posted in Blogging
- Comments 0
I just finished off this simple little PHP function that some of you may find useful.
It’s a quick way to determine whether a site is valid or not, returning a simple “true or false” result.
Requires the Snoopy class.
function w3Valid($url) {
require("Snoopy.class.php");
$snoopy = new Snoopy;
$snoopy->fetchtext("http://validator.w3.org/check?uri=" . $url . "&output=soap12");
$validator_output = $snoopy->results;
if(preg_match("/false/", $validator_output)) {
return false;
} else {
return true;
}
}