通过php

时间:2015-09-19 03:21:05

标签: php fingerprint fsockopen

我尝试将指纹连接到php,但会出现此错误消息:

  

警告:fsockopen():无法连接到192.168.1.102:80(连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接主机无法响应而建立连接失败。)

这是我的代码

<?
$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>
<?}?>

请帮帮我,为什么我不能将php连接到指纹?

更新

我可以ping 192.168.1.102,但我不能从php调用它。

1 个答案:

答案 0 :(得分:1)

您的指纹可能不支持网络服务

使用地址栏中的输入192.168.1.102查看您的浏览器