31 lines
715 B
PHP
31 lines
715 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class HtmlValidator
|
|
{
|
|
public static function validateHtml(string $html)
|
|
{
|
|
$response = Http::withHeaders([
|
|
'Content-Type' => 'text/html; charset=utf-8',
|
|
])->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();
|
|
|
|
return $json;
|
|
}
|
|
}
|