Re: validator won't return json

Ahh, not quite right.  I needed the prefill and group parameters setup
correctly to get a completely proper response.  Namely the validate not
complaining about the div, cause it's supposed to be a fragment, not a
complete document.

So, the revised POST is...

POST /check HTTP/1.1
User-Agent: PECL::HTTP/1.7.4 (PHP/5.4.6-1ubuntu1)
Host: validator.w3.org
Accept: */*
Content-Length: 178
Content-Type: application/x-www-form-urlencoded

fragment=%3Cdiv%3E%0A%3Cp%3E%20invalid%20document%20not%20ending%20p%20tag%0A%3C%2Fdiv%3E&output=json&doctype=XHTML%201.0%20Transitional&prefill_doctype=xhtml10&prefill=1&group=0


On Thu, Mar 14, 2013 at 7:18 PM, Trenton D. Adams <trenton.d.adams@gmail.com
> wrote:

> Oh, and thanks very much for provoking me to look again.  I must have done
> something wrong.  Not sure if it's javascript library I'm using that messed
> up or what, but now I know it can work, and if it doesn't, I'll do it
> manually.
>
>
> On Thu, Mar 14, 2013 at 7:17 PM, Trenton D. Adams <
> trenton.d.adams@gmail.com> wrote:
>
>> Yeah, I don't know what I did wrong, but I'm going to try again at some
>> point. I took what you did, and tried it manually.  If you paste this into
>> telnet on port 80, it works great, and tells me that I did not end the 'p'
>> tag.
>>
>> telnet validator.w3.org 80
>>
>> POST /check HTTP/1.1
>> User-Agent: PECL::HTTP/1.7.4 (PHP/5.4.6-1ubuntu1)
>> Host: validator.w3.org
>> Accept: */*
>> Content-Length: 160
>> Content-Type: application/x-www-form-urlencoded
>>
>>
>> fragment=%3Cdiv%3E%0A%3Cp%3E%20invalid%20document%20not%20ending%20p%20tag%0A%3C%2Fdiv%3E&output=json&doctype=XHTML%201.0%20Transitional&prefill_doctype=xhtml10
>>
>>
>>
>> On Thu, Mar 14, 2013 at 9:25 AM, Trenton D. Adams <
>> trenton.d.adams@gmail.com> wrote:
>>
>>> I tried the fragment parameter as you did as well.  Perhaps there was a
>>> typo; I'll try again.
>>>
>>>
>>> On Thu, Mar 14, 2013 at 2:45 AM, Jon Cram <jon@webignition.net> wrote:
>>>
>>>> I recall when first running a local install of the W3C HTML validator
>>>> there was some trial and error involved in getting JSON output.
>>>>
>>>> It certainly does work. If it's not working for you my best guess is
>>>> that the POST requests you're making aren't quite to the validator's liking.
>>>>
>>>> I just ran a local validation that successfully returned a JSON
>>>> response. At the following URL is the exact raw HTTP request I issued:
>>>> http://pastebin.com/npX42TtE
>>>>
>>>> Check how this compares to the HTTP requests you're making.
>>>>
>>>>
>>>>
>>>> On 10/03/13 19:20, Trenton D. Adams wrote:
>>>>
>>>>> Any developers on here that might know what the problem is here?
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 1, 2013 at 6:45 PM, Trenton D. Adams <
>>>>> trenton.d.adams@gmail.com <mailto:trenton.d.adams@gmail.**com<trenton.d.adams@gmail.com>>>
>>>>> wrote:
>>>>>
>>>>>     Before I file a bug, I thought I would ask why this does not
>>>>>     work.  I sent the output=json, and then url encoded the
>>>>>     uploaded_file as well.  I know
>>>>>     http://validator.w3.org/docs/**api.html#soap12format<http://validator.w3.org/docs/api.html#soap12format>says that the
>>>>>     uploaded_file should be multi-part form-data, but that also did
>>>>>     not seem to return the json; unless I got the syntax wrong.  If I
>>>>>     use the "uri" option instead, it appears to work fine.  In either
>>>>>     of the two failed cases, there are special headers returned
>>>>>     indicating that the validation of the fragment failed, how many
>>>>>     errors, how many warnings, etc.
>>>>>
>>>>>     Any help would be appreciated, thank you.
>>>>>
>>>>>
>>>>>     http://validator.w3.org/check
>>>>>
>>>>>     POST /check HTTP/1.1
>>>>>     Host: validator.w3.org <http://validator.w3.org>
>>>>>
>>>>>     User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0)
>>>>>     Gecko/20100101 Firefox/16.0
>>>>>     Accept: application/json, text/javascript, */*; q=0.01
>>>>>     Accept-Language:
>>>>>     en-CA,en;q=0.9,en-US;q=0.8,en-**gb;q=0.7,en-US-x-Hixie;q=0.6,**
>>>>> fr-FR;q=0.4,fr;q=0.3,eo-EO;q=**0.2,eo;q=0.1
>>>>>     Accept-Encoding: gzip, deflate
>>>>>     Connection: keep-alive
>>>>>     Content-Type: application/x-www-form-**urlencoded; charset=UTF-8
>>>>>     Referer:
>>>>>     http://reuben.pc.athabascau.**ca:8080/aucm/servlet/**
>>>>> DispatcherServlet?action=**examRequest<http://reuben.pc.athabascau.ca:8080/aucm/servlet/DispatcherServlet?action=examRequest>
>>>>>
>>>>>     Content-Length: 17174
>>>>>     Origin: http://reuben.pc.athabascau.**ca:8080<http://reuben.pc.athabascau.ca:8080>
>>>>>     Pragma: no-cache
>>>>>     Cache-Control: no-cache
>>>>>     output=json&uploaded_file=%0A%**0A%0A%0A%0A%0A%0A%0A%3Cblah-**
>>>>> blah-encoded-fragment
>>>>>
>>>>>
>>>>>     HTTP/1.1 200 OK
>>>>>     Date: Sat, 02 Mar 2013 01:34:11 GMT
>>>>>     Server: Apache/2.2.16 (Debian)
>>>>>     X-W3C-Validator-Recursion: 1
>>>>>     X-W3C-Validator-Status: Invalid
>>>>>     X-W3C-Validator-Errors: 4
>>>>>     X-W3C-Validator-Warnings: 23
>>>>>     Content-Type: application/json; charset=UTF-8
>>>>>     Connection: close
>>>>>     Transfer-Encoding: chunked
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>

Received on Friday, 15 March 2013 06:42:32 UTC