沃梦达 / 编程问答 / php问题 / 正文

如何从 GPS 获取数据并发送到服务器以及如何保存到数据库

How to get data from GPS and send to server and how save to database(如何从 GPS 获取数据并发送到服务器以及如何保存到数据库)

本文介绍了如何从 GPS 获取数据并发送到服务器以及如何保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 PHP 设计了一个网页,可以从数据库中读取数据,包括纬度、经度、速度,并将数据显示在地图上.我有一个MVT380追踪器,我可以设置IP和端口,所以通过GPRS的数据可以发送到这些IP和端口.

I designed a web page with PHP, the data can be read from database including lat, long, speed and it displays the data on a map. I have a MVT380 tracker that I can set IP and port on, so the data through GPRS can be sent to these IP and port.

问题是如何读取数据并将其保存到数据库中(有没有什么特殊的硬件可以将发送的数据读取到这些IP和端口并将其保存到数据库中?或者我们应该设计一个可以读取数据的网页吗?通过 GET/POST 协议获取数据并将其保存到数据库?).有没有其他办法?

The problem is how to read the data and save it in database (is there any special hardware that can read the sent data to these IP and port and save it to database? or should we design a web page that can read the data through GET/POST protocol and save it to database?). Is there any other way?

推荐答案

我也有同样的问题:如何使用 PHP 从设备接收 GPS 数据?

经过一番挣扎,这就是我得到的:

After a little struggle this is what I got:

对于将 TCP/UDP 数据发送到 IP 地址和端口的 GPS 跟踪设备,我们确实需要一个服务器.不会有 POST/GET 数据.服务器将通过需要解码的端口接收数据.但它并没有我想象的那么复杂.即使没有任何 Java 知识,我也能够安装软件并根据自己的喜好对其进行操作.

For a gps tracker device that sends TCP/UDP data to an ip address and port we really need a server. There will be no POST/GET data. The server will receive data through a port that needs to be decoded. But it was not as complicated as I thought. Even without any knowledge of Java I was able to install a software and manipulate it to my liking.

我做了什么:

有一个 Windows 服务器 (2012) 托管(6 个月免费),所以我可以尝试一下.下载了 opengts 并完全按照他们的说明手册进行操作.而且一点也不难.它工作起来没有太多头痛一旦我到达一切正常的部分,我就可以使用该设备并且它工作正常.当然,我们需要知道设备正在发送和解码的协议(数据),以便将其保存在数据库中.

Got a windows server (2012) hosting (6 months for free) so I could try it out. Downloaded opengts and followed their instruction manual exactly. And did not find it hard at all. It worked without having much headache Once I got to the part where everything was working I could play around with the device and it was working fine. Ofcourse we need to know the protocol (the data) that the device is sending and decode so it can be saved in the database.

这篇关于如何从 GPS 获取数据并发送到服务器以及如何保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何从 GPS 获取数据并发送到服务器以及如何保存到数据库

基础教程推荐