0
votes

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.

1
Is there a service listening to port 80 on 192.168.1.102? The error you got suggests that your code is working fine ... but you're knocking on the door and no-one is home.Ragdata
@Ragdata check my update. I can ping on 192.168.1.102, but i cant call it from php.heruprambadi
Likely then you don't have anything listening on port 80 on that machine - or port 80 has been firewalled and is not accessible from the local network.Ragdata
@Ragdata but why ? is there any problem with my FP ? i try with desktop software, its fine.heruprambadi
Are we talking about the X100-C here?Ragdata

1 Answers

1
votes

Your fingerprint may not support web service

Check with your browser, by input 192.168.1.102 in address bar