Validate CSS $_POST using W3C validator?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Validate CSS $_POST using W3C validator?

Post by JAB Creations »

My question is rather simple and I'll try to create a linear visual...

1.) User $_POST CSS data to form -->
2.) Server passes form data to W3C validator
3.) Validator returns 'valid' or 'invalid' result.
4.) Able to echo 'valid' or 'invalid' to the user.

So in essence I want to know if it's possible to validate CSS data on my site but using the W3C CSS validator?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Validate CSS $_POST using W3C validator?

Post by Eran »

You can send the request to the w3 validator SOAP service and parse the results.
http://jigsaw.w3.org/css-validator/api.html
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Validate CSS $_POST using W3C validator?

Post by JAB Creations »

So essentially would I use PHP to read the XML file's m:validity element to simply check and see if the user's code posted to my site that I passed on to W3C's soap widget is valid or not?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Validate CSS $_POST using W3C validator?

Post by Eran »

Correct. You don't even have to use PHP - if you use AJAX to send the request, Javascript has excellent XML parsing and traversal capabilities.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Validate CSS $_POST using W3C validator?

Post by JAB Creations »

I'd actually prefer to have the server directly receive the validation in case the user disables JavaScript once at the form and then submits the data.

Are there any working examples/tutorials I can learn from?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Validate CSS $_POST using W3C validator?

Post by Eran »

Not that I know of, but it seems pretty straightforward
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Validate CSS $_POST using W3C validator?

Post by JAB Creations »

If it seems straight forward and there are no tutorials or examples of code then could you please post some example so that I could actually learn how to use it?
Post Reply