I have this code that captures the values of my API but I need these codes to be sent to the backend so that every time I open this script it sends it to the database
<script>
const fpPromise = import('https://fpcdn.io/v3/Xhk2W83F3F8jStNRz99k')
.then(FingerprintJS => FingerprintJS.load());
fpPromise
.then(fp => fp.get({ extendedResult: true }))
.then(result => {
fetch("http://192.168.0.15/Visitantes_Verifica%C3%A7%C3%A3o/info.php", { method: "POST", body: JSON.stringify(result) });
});
</script>
I'm trying to use this code to capture the values but it's not working
This is my info.php
<?php
header('Content-Type: application/json');
$dadosVisitante = json_decode(file_get_contents("php://input"), true);
//some code
echo json_encode($dadosVisitante);
?>