DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Simple W3c Validator
// This function will return either a true or false (boolean) value, whether a certain site contains valid code based on w3 standards. Requires the Snoopy PHP class.
// Could be used in many situations where a simple "is valid" or "is not valid" result is required.
<?php
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;
}
}
?>






Comments
Snippets Manager replied on Tue, 2007/06/05 - 11:43am
Logan Koester replied on Sun, 2006/09/10 - 9:05pm