1
0

Added CSS validation

This commit is contained in:
Richard Dern 2024-05-09 16:03:53 +02:00
parent ae17c69a72
commit 7d680adea7

View File

@ -6,11 +6,22 @@
class HtmlValidator class HtmlValidator
{ {
public static function validateSource(string $html) public static function validateHtml(string $html)
{ {
$response = Http::withHeaders([ $response = Http::withHeaders([
'Content-Type' => 'text/html; charset=utf-8', 'Content-Type' => 'text/html; charset=utf-8',
])->withBody($html, 'text/html')->post(env('HTML5_VALIDATOR_URL') . '/?out=json'); ])->withBody($html, 'text/html')->post(env('HTML_VALIDATOR_URL') . '/?out=json');
$json = $response->json();
return $json;
}
public static function validateCss(string $css)
{
$response = Http::withHeaders([
'Content-Type' => 'text/css; charset=utf-8',
])->withBody($css, 'text/css')->post(env('CSS_VALIDATOR_URL') . '/?out=json');
$json = $response->json(); $json = $response->json();