forked from ByLegenS/UBL-TR-Schematron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
46 lines (39 loc) · 1.11 KB
/
example.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
<?php
/* UBL Kontrolü */
function UBLTesti($java_dosyasi, $ubl_dosyasi, $fatura_dosyasi, $return=false)
{
/* Java Dosyasına Veri Yollanıyor */
exec("java -Dfile.encoding=UTF8 -jar $java_dosyasi $ubl_dosyasi $fatura_dosyasi 2>&1", $cikti);
/* Önemsiz Hatalar Temizleniyor */
foreach($cikti as $anahtar => $deger)
{
if(stristr($deger, 'The child axis starting') == true)
unset($cikti[$anahtar]);
if(stristr($deger, 'Warning: on line') == true)
unset($cikti[$anahtar]);
}
/* Hatalar Ekrana Yazdırılıyor */
if($return == false)
{
if(count($cikti) > 0)
{
foreach($cikti as $ciktiSonuc)
echo $ciktiSonuc.'<br />';
exit();
}
}
else return $cikti;
}
/* UBL Kontrolü */
$dizin = (__DIR__ . DIRECTORY_SEPARATOR);
$java_dosyasi=$dizin."Java/NTG_UBLTR_Schematron.jar";
$ubl_dosyasi=$dizin."Schematron/UBL-TR_Main_Schematron.xml";
$fatura_dosyasi='TemelFaturaOrnegi.xml';
$cikti = UBLTesti($java_dosyasi, $ubl_dosyasi, $fatura_dosyasi, true);
if(count($cikti) > 0)
{
foreach($cikti as $ciktiSonuc)
echo $ciktiSonuc.'<br />';
}
else echo 'Hata Yok...';
?>