-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
59 lines (46 loc) · 1.86 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require_once __DIR__ . '/src/utilidades.php';
require_once __DIR__ . '/src/LecturaXML.php';
require_once __DIR__ . '/src/ValidaCFDI.php';
function validarFactua($cfdi = null)
{
try {
$lecturaXML = new LecturaXML($cfdi);
if ($lecturaXML->cargado() === true) {
$validaCFDI = new ValidaCFDI;
$respuestas = $validaCFDI->validar($lecturaXML);
} else {
throw new Exception("El archivo proporcionado no pudo ser cargado. Asegurese que proporciona un archivo XML.");
}
} catch (Exception $e) {
$respuestas = $e->getMessage();
}
return $respuestas;
}
if (validarArchivoEntrante('fact', 'text/xml') === true) {
extract($_FILES['fact']);
$validacion = validarFactua($tmp_name);
debug($validacion);
}
?>
<!DOCTYPE html>
<html lang="es_ES" class="no-js">
<head>
<title>Validador de CFDi</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="Un pequeño script en PHP que permite conectarte al WS del SAT para validar el estatus de un CFDI's.">
<!--<link href="images/favicon.png" rel="shortcut icon">
<link href="styles/general.css" rel="stylesheet">
<script src="js/script.js"></script>-->
</head>
<body>
<form action="./index.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
<label>Seleccióne XML factura: </label>
<input type="file" name="fact" value=""/>
<br/>
<input type="submit" value="Validar"/>
</form>
</body>
</html>