Never been to DZone Snippets before?

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

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

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.

   1  
   2  <?php
   3  function w3Valid($url) {
   4  	require("Snoopy.class.php");
   5  	$snoopy = new Snoopy;
   6  
   7  	$snoopy->fetchtext("http://validator.w3.org/check?uri=" . $url . "&output=soap12");
   8  	$validator_output = $snoopy->results;
   9  
  10  	if(preg_match("/false/", $validator_output)) {
  11  		return false;
  12  	} else {
  13  		return true;
  14  	}
  15  }
  16  
  17  ?>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS