Over a million developers have joined DZone.

Simple W3c Validator

DZone's Guide to

Simple W3c Validator

Free Resource
// 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;


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

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


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

{{ parent.tldr }}

{{ parent.urlSource.name }}