私はこのサーバ(アラーム処理ユニットデバイス)に接続するためにPHPソケットプログラミングを使用して、ビデオライブを表示するために他のものを処理したいXMLファイルデータを受け取ります同じネットワーク上のカメラからのストリーム。私はそれに接続し、情報を取得するためにPHPソケットを使用することができた情報が複数に来る、私は常に同じ4つの場所でそれを繰り返す同じXMLデータを持っています。複数のxmlデータをソケットPHP上のサーバから出力
これは、常に私は、これは私が結果出力 それをwhileループを削除することを決定した場合、私はotput
<?php
//timeout limit
set_time_limit(0);
//Creating Socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "<br />";
} else {
echo "OK.<br />";
}
echo "Attempting to connect to the socket'...";
$result = socket_connect($socket, '192.168.43.50', 10001);
if ($result === false) {
echo "socket_connect() failed.<br />Reason: ($result) " . socket_strerror(socket_last_error($socket)) . "<br />";
} else {
echo "OK.<br />";
}
$in = "GET/HTTP/1.1\r<br />";
$in .= "Host: 192.168.43.50\r<br />";
$in .= "Content-Type: application/xml; encoding=UTF-8\r\n";
$in .= "Accept: application/xml\n";
$in .= "Connection: Close\r<br />\r<br />";
$out = '<?xml version="1.0" encoding="UTF-8" ?>';
$out= '';
echo "Sending HTTP HEAD request...";
socket_write($socket, $in, strlen($in));
echo "OK.<br />";
echo "Reading response:<br /><br />";
while ($out = socket_read($socket, 2048)) {
echo htmlspecialchars ($out)."<br /><br />";
}
echo "Closing socket...";
socket_close($socket);
echo "OK.<br /><br />";
?>
をもたらすことがあり、コードで
<?xml version="1.0" encoding="UTF-8"?> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR APU</DeviceType> </PlatformIdentification> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:24.091</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:24.091</UpdateTime> </Status> </DeviceStatusReport> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:24.091</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:24.091</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification>
<DeviceName>tes1.H2.Z3</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:24.091</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> </PlatformStatusReport>
<?xml version="1.0" encoding="UTF-8"?> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR APU</DeviceType> </PlatformIdentification> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:44.103</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:44.103</UpdateTime> </Status> </DeviceStatusReport> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:44.103</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:44.103</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification>
<DeviceName>tes1.H2.Z3</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:36:44.103</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> </PlatformStatusReport>
<?xml version="1.0" encoding="UTF-8"?> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR APU</DeviceType> </PlatformIdentification> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:04.118</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:04.118</UpdateTime> </Status> </DeviceStatusReport> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:04.118</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:04.118</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification>
<DeviceName>tes1.H2.Z3</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:04.118</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> </PlatformStatusReport>
<?xml version="1.0" encoding="UTF-8"?> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR APU</DeviceType> </PlatformIdentification> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:24.136</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z1</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:24.136</UpdateTime> </Status> </DeviceStatusReport> <DeviceStatusReport> <DeviceIdentification> <DeviceName>tes1.H1.Z2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Zone</DeviceType> </DeviceIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:24.136</UpdateTime> </Status> </DeviceStatusReport> </PlatformStatusReport> <PlatformStatusReport> <PlatformIdentification> <DeviceName>tes1.H2</DeviceName> <DeviceCategory>Sensor</DeviceCategory> <DeviceType>SPIDR Hyperzone</DeviceType> </PlatformIdentification> <Status> <DeviceState>Secure</DeviceState> <CommunicationState>OK</CommunicationState> <UpdateTime Zone="GMT">2017-07-12T21:37:24.136</UpdateTime> </Status> <DeviceStatusReport> <DeviceIdentification>
を得る結果であります必要な情報の単一行を表示し、接続を停止しますが、システムがリアルタイム監視ソリューションになっているため、その必要はありません。これは、常にサーバーに接続されている必要があります。ネットワーク
どうすればいいですか? ありがとう
xml ID
jdweng