我以前的项目是使用jsxmlsocket(https://www.developerfusion.com/project/18979/jsxmlsocket)开发的。它正在使用闪光灯。通过ip和port连接的js xml套接字,然后像这样的响应{“ ClientID”:“ 202.75.xx.xxx:xxxxx","ServerDist":"1”}通过使用此客户端ID,我正在发送车辆设备ID,所以我正在连续获取所有车辆信息。
但是现在我正在PHP套接字中工作,正在获取客户端ID和ServerDist,在使用具有设备ID的sednig ClientID之后,我再也没有获得正确的客户端信息,而我正在获取ClientID和ServerDist那么请您能帮我如何获取设备数据
<?php
$message = json_encode(["ClientID" => $ClientID, 'LanguageType' => 'en-us', "TrackSystemNos" => '1399288XXXX|']);
if (socket_send($socket, $message, strlen($message), 0)) {
echo "Message send successfully \n" . $message . '<br/>';
sleep(2);
while (true) {
echo socket_recvfrom($socket, $buf, 9204, 0, $host, $port);
echo "Received $buf from remote address $fhost and remote port $fport" . PHP_EOL;
sleep(2);
}
}
我需要这样的答复:
{
"SimID":"139928XXXXX",
"SignalType":"Locate",
"DateTime":"2019-10-24 13:31:40",
"Longitude1":"0.00000",
"Latitude1":"0.00000",
"Longitude":"0.00000",
"Latitude":"0.00000",
"Velocity":"0",
"Angle":"0",
"LocateStatus":"NoLocate",
"AccStatus":"OFF",
"Temperature":"0",
"Oil":"0",
"Oil2":"0",
"LevelNum":"12.13",
"OilIn":"0",
"OilOut":"0",
"Miles":"7611669",
"ParkingSpan":"1.11:54:59",
"TodayMile":"61321"
}