- From: Terje Bless <link@pobox.com>
- Date: Wed, 4 Dec 2002 21:53:16 +0100
- To: W3C Validator <www-validator@w3.org>
Since somebody asked about this in another forum I thought y'all might be interested. The following is a little Perl snippet to post a file to the Validator and, in this case, getting an XML report back. Save this as e.g. "post.pl" and run it as "./post.pl file.html": #!/usr/bin/perl use LWP::UserAgent; use HTTP::Request::Common 'POST'; print LWP::UserAgent ->new ->request( POST 'http://validator.w3.org/check', Content_Type => 'form-data', Content => [ output => 'xml', uploaded_file => [$ARGV[0]], ] )->as_string; __END__ The "output" parameter can be adjusted to suit you ("xml", "earl", "n3") or omitted alltogether to get the HTML report. Other interesting parameters are "charset" (value is any charset we support (quite a few)) and "verbose" ("0" or "1") for verbose results in the HTML report only. Note that this does not imply that the XML (or n3, or earl) interfaces are any less beta then they were. It's just a usefull little snippet for playing around with this. -- Everytime I write a rhyme these people thinks its a crime I tell `em what's on my mind. I guess I'm a CRIMINAL! I don't gotta say a word I just flip `em the bird and keep goin, I don't take shit from no one. I'm a CRIMINAL!
Received on Wednesday, 4 December 2002 15:53:19 UTC