I have been using Pear W3C HTML Validator to validate websites in house. We have started been working with a custom created CMS that stores the full html code in a database. I have been searching everywhere to find an easy way to run checks on a string rather than a url.
This is the basic code that they offer on their site.
<?php
require_once 'Services/W3C/HTMLValidator.php';
$v = new Services_W3C_HTMLValidator();
$u = 'http://www.unl.edu/';
$r = $v->validate($u);
if ($r->isValid()) { echo $u.' is valid!'; }
else { echo $u.' is NOT valid!'; }
?>
Is there a current function to run a string or will I have to manually edit the files to create a function.
$v->validateFragment($html);Seriously, just read the code! You already have it on your system 🙂
https://github.com/pear/Services_W3C_HTMLValidator/blob/trunk/Services/W3C/HTMLValidator.php