I have a GPS device which is sending data to my server 103.209.146.80
and port 5672
I want to create a php script or a JS script which reads the incoming data on this port.
My first step is to catch the data. I am using this PHP code but it is giving error:
<?php
$fp = fsockopen("103.209.146.80", 5672, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "You message");
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
You must first know what type of connection tcp or udp transmits your GPS, then create a socket server (tcp / udp) that listens on the port where you will transmit your GPS.
Do not forget that you must configure a valid APN in your GPS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.