Html Validation service
This commit is contained in:
parent
beb701d752
commit
3b02c21e4c
19
app/Services/HtmlValidator.php
Normal file
19
app/Services/HtmlValidator.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
class HtmlValidator
|
||||||
|
{
|
||||||
|
public static function validateSource(string $html)
|
||||||
|
{
|
||||||
|
$response = Http::withHeaders([
|
||||||
|
'Content-Type' => 'text/html; charset=utf-8',
|
||||||
|
])->withBody($html, 'text/html')->post('http://nu-validator:8888/?out=json');
|
||||||
|
|
||||||
|
$json = $response->json();
|
||||||
|
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user