1
0
cms11/app/Services/HtmlValidator.php

31 lines
715 B
PHP
Raw Normal View History

2024-05-09 01:11:05 +02:00
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
class HtmlValidator
{
2024-05-09 16:03:53 +02:00
public static function validateHtml(string $html)
2024-05-09 01:11:05 +02:00
{
$response = Http::withHeaders([
'Content-Type' => 'text/html; charset=utf-8',
2024-05-09 16:03:53 +02:00
])->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');
2024-05-09 01:11:05 +02:00
$json = $response->json();
return $json;
}
}