Saturday, June 13, 2020

Mengirim sidik jari user ke mesin Fingerprint

Sebelum ke sini baca ini :
  1. Memilih fingerprint yang support PHP
  2. Parse Data SOAP fingerprint

Untuk mengirim data sidik jari user ke mesin Fingerprint, terlebih dahulu mesin fingerprint harus disetting IP dan Commkey nya.

kemudian buat file 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
60
61
62
63
64
65
66
67
68
69
<html>
<head><title>Contoh Koneksi Mesin Absensi Mengunakan SOAP Web Service</title></head>
<body bgcolor="#caffcb">

<H3>Upload Sidik Jari</H3>

<?php
$IP= filter_input(INPUT_GET, "ip");
$Key=filter_input(INPUT_GET, "key");
$id=filter_input(INPUT_GET, "id");
$fn=filter_input(INPUT_GET, "fn");
$temp=filter_input(INPUT_GET, "temp");

if($IP=="") $IP="192.168.1.201";
if($Key=="") $Key="123456";
if($id=="") $id="1";
if($fn=="") $fn="0";
?>

<form action="upload-sidik-jari.php">
IP Address: <input type="Text" name="ip" value="<?php echo $IP?>" size=15><BR>
Comm Key: <input type="Text" name="key" size="5" value="<?php echo $Key?>"><BR><BR>

UserID: <input type="Text" name="id" size="5" value="<?php echo $id?>"><BR>
Finger No: <input type="Text" name="fn" size="1" value="<?php echo $fn?>"><BR><BR>
Template Sidik jari: <BR>
<textarea name="temp" rows="7" name="isi" cols="40"><?php echo $temp?></textarea><BR><BR>

<input type="Submit" value="Upload">
</form>
<BR>

<?php
if(filter_input(INPUT_GET, "ip")!=""){?>

 <?php
 $Connect = fsockopen($IP, "80", $errno, $errstr, 1);
 if($Connect){
  $soap_request="<SetUserTemplate><ArgComKey xsi:type=\"xsd:integer\">".$Key."</ArgComKey><Arg><PIN xsi:type=\"xsd:integer\">".$id."</PIN><FingerID xsi:type=\"xsd:integer\">".$fn."</FingerID><Size>".strlen($temp)."</Size><Valid>1</Valid><Template>".$temp."</Template></Arg></SetUserTemplate>";
  $newLine="\r\n";
  fputs($Connect, "POST /iWsService HTTP/1.0".$newLine);
     fputs($Connect, "Content-Type: text/xml".$newLine);
     fputs($Connect, "Content-Length: ".strlen($soap_request).$newLine.$newLine);
     fputs($Connect, $soap_request.$newLine);
  $buffer="";
  while($Response=fgets($Connect, 1024)){
   $buffer=$buffer.$Response;
  }
        }else {echo "Koneksi Gagal";};
 include("parse.php");
// echo $buffer;
 $buffer=Parse_Data($buffer,"<SetUserTemplateResponse>","</SetUserTemplateResponse>");
 $buffer=Parse_Data($buffer,"<Information>","</Information>");
 echo "<B>Result:</B><BR>".$buffer;
 
 //Refresh DB
 $Connect = fsockopen($IP, "80", $errno, $errstr, 1);
 $soap_request="<RefreshDB><ArgComKey xsi:type=\"xsd:integer\">".$Key."</ArgComKey></RefreshDB>";
 $newLine="\r\n";
 fputs($Connect, "POST /iWsService HTTP/1.0".$newLine);
    fputs($Connect, "Content-Type: text/xml".$newLine);
    fputs($Connect, "Content-Length: ".strlen($soap_request).$newLine.$newLine);
    fputs($Connect, $soap_request.$newLine);

}?>


</body>
</html>

No comments:

Post a Comment

Popular Posts