Over a million developers have joined DZone.

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.


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;
	}
}

?>
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}