Reputation: 61
i try to connect finger print to php, but this error message appears:
Warning: fsockopen(): unable to connect to 192.168.1.102:80 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
here is my code
<?
$IP=$_GET["ip"];
$Key=$_GET["key"];
if($IP=="") $IP="192.168.1.201";
if($Key=="") $Key="0";
?>
<form action="tarik-data.php">
IP Address: <input type="Text" name="ip" value="<?=$IP?>" size=15><BR>
Comm Key: <input type="Text" name="key" size="5" value="<?=$Key?>"><BR><BR>
<input type="Submit" value="Download">
</form>
<BR>
<?
if($_GET["ip"]!=""){?>
<table cellspacing="2" cellpadding="2" border="1">
<tr align="center">
<td><B>UserID</B></td>
<td width="200"><B>Tanggal & Jam</B></td>
<td><B>Verifikasi</B></td>
<td><B>Status</B></td>
</tr>
<?
$Connect = fsockopen($IP, "80", $errno, $errstr, 1);
if($Connect){
$soap_request="<GetAttLog><ArgComKey xsi:type=\"xsd:integer\">".$Key."</ArgComKey><Arg><PIN xsi:type=\"xsd:integer\">All</PIN></Arg></GetAttLog>";
$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");
$buffer=Parse_Data($buffer,"<GetAttLogResponse>","</GetAttLogResponse>");
$buffer=explode("\r\n",$buffer);
for($a=0;$a<count($buffer);$a++){
$data=Parse_Data($buffer[$a],"<Row>","</Row>");
$PIN=Parse_Data($data,"<PIN>","</PIN>");
$DateTime=Parse_Data($data,"<DateTime>","</DateTime>");
$Verified=Parse_Data($data,"<Verified>","</Verified>");
$Status=Parse_Data($data,"<Status>","</Status>");
?>
<tr align="center">
<td><?echo $PIN?></td>
<td><?=$DateTime?></td>
<td><?=$Verified?></td>
<td><?=$Status?></td>
</tr>
<?}?>
</table>
<?}?>
please help me, why i cant connect php to fingerprint ?
UPDATE
I can ping on 192.168.1.102, but i cant call it from php.
Upvotes: 0
Views: 3498
Reputation: 11
Your fingerprint may not support web service
Check with your browser, by input 192.168.1.102 in address bar
Upvotes: 1