Hi,
We are using the W3 validator service to check some pages on our website.
Checking a whole file with GET (passing the URL) works fine. Here is a code sample:
main
define
url string,
http_req com.HTTPRequest,
http_resp com.HTTPResponse,
doc xml.DomDocument,
validate_node xml.domNode
let http_req = com.HTTPRequest.Create("
https://validator.w3.org/nu/")
let url = "
http://infohorse.hrnz.co.nz/datahr/results/012557rs.htm"
call http_req.setMethod( "GET" )
call http_req.doFormEncodedRequest( sfmt("out=xml&doc=%1", url.trim()), TRUE )
let http_resp = http_req.getResponse()
if http_resp.getStatusCode() = 200 then
let doc = http_resp.getXmlResponse()
call doc.setFeature("format-pretty-print", TRUE)
let validate_node = doc.getDocumentElement()
display " debug jjt validate_node = ", validate_node.toString()
else
display " debug no good ", http_resp.getStatusCode()
end if
end main
What we would like to do in addition to checking the whole file is check an HTML string.
This looks like it requires a POST. I do not see how this works.
The validator documentation has an example using java. See:
https://github.com/validator/validator/wiki/Service:-Input:-POST-bodyHow can I do the equivalent of:
.queryString("out", "xml")
.body(source)
I don't see a combination of methods that allows me to pass the parameters, and the html string to check as the body.
Any help would be appreciated.
John