I’m writing a blog, and I want to make sure that all my pages validate as XHTML. I want to let people post comments, but they might not post validating HTML.
So I thought I’d use the W3’s XHTML validator(saves me a lot of work)
The problem with this is that the W3’s XHTML validator accepts data via POST only, and not GET:trout:.
Does anyone know how I can send info to another page on a whole different server using POST, and then read the data sent back?
I know how to use fopen() to manipulate data for GET pages, it’s just POST that is the problem.
In case anyone wants to know how, I used cURL from the command line. My host must have got it installed or something(they didn’t have the library).
Here’s the code I used:
<?php
$html = urlencode(
'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>test</title></head>
<body><p>This is a test of the XHTML validator</p></body>
</html>
');
$var = shell_exec("curl -d \"area=$html&charset=UTF-8&warnings=yes&input=yes\" http://www.htmlhelp.com/cgi-bin/validate.cgi");
print $var;
?>