How To Call The W3C Validator API Programmatically For A Batch Using PHP

It's only fair to share...Share on Facebook0Share on Google+8Tweet about this on Twitter0Share on LinkedIn7Pin on Pinterest1Digg thisShare on StumbleUpon0

w3c api using php
W3C validator provide “Markup Validator Web Service API“, which we can use for batch validation of web pages. This class can be used to validate an HTML page using the W3C validator API and PHP. Using this class, we send a HTTP request to W3C validator web server to validate the HTML page by given URL. This class parses the response which we are getting from W3C web server and based on this, it returns whether the page has any validation errors or not.

Note: If you wish to call the validator programmatically for a batch of documents, please make sure that your script will sleep for at least 1 second between requests. For more detail check the Markup Validator Web Service API document.

In this sample code, I have all the HTML file in a specific folder. I have uploaded this folder on server and execute the script.

Code to use API class:

W3c Validation API Class:



Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">