0

I have a car GPS device, the only thing I can change is the IP-address.

Is it possible to have shared hosting with a dedicated IP-address (that part is possible) and then to have a PHP script that picks up the data that is being send?

So what is in my mind:

  • GPS device send gps data to IP-address.
  • That IP-address has a PHP script that picks up the data and use it.

As requested a little bit more detailed. There is a question that is exactly the same but don't have an answer: how-to-get-data-from-gps-and-send-to-server-and-how-save-to-database

It is a Chinese car GPS device with a standard IP address. So it sends data to that IP address. Then they give us a website where we can login with the product code and we can see the GPS location.

It is possible to change the IP address in this device. I have found shared hosting with a dedicated IP address, but that means the IP address just replaces the URL so it works just as an URL, so it is not that I can change the server and install something like openGTS.

But I have no idea what kind of data (I don't think it is just GET or POST data) this device is sending. So I am wondering if the GPS is sending the data to an IP address whether I have to do something special with java on that server or I am able to use a PHP script to pickup what the GPS device is sending? Once I get the data I know what to do with it. All I need is the data to be picked up by a PHP script.

Community
  • 1
  • 1
OSDM
  • 265
  • 1
  • 2
  • 10
  • Hi and welcome to SO! Your question is a tad unclear, what is it that you need our hep with? - I'd also recommend giving http://stackoverflow.com/help/how-to-ask a read. – Epodax May 18 '15 at 10:42

4 Answers4

4

There is not a shortcut as I was hoping. 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.

What I did:

  • 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.
OSDM
  • 265
  • 1
  • 2
  • 10
3

you need this:

  1. The phone(Number) (with GPS).
  2. A SmartPhone( Androir and develop your own APP) - (Like a Sub-Server).
  3. A (Home Server) or (WebServer) with MySQL(Data Base).
  4. A Script with PHP in your Server or WebPage(Point 3).

So:

  1. The (Phone Number with GPS) just wait for a call or something to send the "Data".
  2. (The SmartPhone) get the data from (The Phone Number with GPS).
  3. Read the Message Board ONLY from your (Phone Number with GPS) with (your Own APP Android) AND Process the "Data" with (your Own Android APP).
  4. Get the "String" of (Lat) and (Lon) Coordinates Or ALL your need from the (Message Board) and SEND to your (PHP Script) using HTTP request to your (Home Server or WebPage) From your (SmartPhone) Using your (Own Android APP).
  5. Work with your (PHP Script) and save in your (MySQL Data Base).
  6. ... you can do everything now with the "Data", like show with other php script and google maps api, or use for a desktop application on java, or visual basic, etc..etc..., or all you wish.

Note: *Not use your (SmartPhone) for nothing, only for prossesing "Data" of ALL (Phone Numbers) your want Using your (Own Android APP) Reading the Message Board with Code, so your (SmartPhone) now is like a "Mini Server" and only works as an intermediary between your (Phone Number with GPS) and your (PHP Script) in your (Home Server or WebPage) with (MySQL Data Base).

Philipp Maurer
  • 2,480
  • 6
  • 18
  • 25
HadeS
  • 31
  • 1
0

You need to use Database, create php script (POST query) and update query into database when GPS position change, than you can have access to this position from database with another php script (GET and return json object)

Michele Lacorte
  • 5,323
  • 7
  • 32
  • 54
  • This is the easy part, but my question would be, is the data really POST or GET data. Reading on the internet is looks like it is special server data and we need a dedicated server and install something like open GTS on that server. – OSDM May 18 '15 at 15:09
  • Of course, you need a server on the internet that use sql database, and into database you must create a table to put your data. – Michele Lacorte May 18 '15 at 15:13
  • Once again that is the easy part, but do you know how most gps devices send their data to the server? Is that POST or GET data, what I doubt? Or do I really need a server where I have to install something like openGTS that works with java etc.??? Because then I don't think I can use shared hosting with dedicated IP address. – OSDM May 18 '15 at 15:40
  • No! , You did not understand Then What I said . You take the data from the phone's GPS ( create a simple app ) and send them to the server ( SQL DATABASE via a php page that is on the server ) so that when you need them , there will be data on the server ( latitude and longitude and all other one you want) , even if you do not get the idea I put an example both of Java for Android and PHP page, otherwise it explains better because I did not understand exactly what you want . – Michele Lacorte May 18 '15 at 15:50
  • I have updated the question. It is a car gps device. So it is not a smartphone, sorry for that. – OSDM May 18 '15 at 16:02
0

If you have a shared hosting, you'll only have the 80 port open. So in your device, you will need to make HTTP requests to that IP on port 80.

In order to make a correct HTTP request, read the RFC2616 (http://www.w3.org/Protocols/rfc2616/rfc2616.html) to get started with HTTP protocol.

At minimum, you will need to provide a hostname and URI in your HTTP request.

On that URI, your PHP script will be able to read data and do something with it.

Dan Bizdadea
  • 1,292
  • 8
  • 15
  • That is if I was able to change all these things in my device. But all I can change is the IP address. What happes after that is not clear to me. – OSDM May 18 '15 at 15:10
  • Then, the simple answer is : YOU CAN'T. You need HTTP Connection in order to be able to POST or GET to that IP. If you can't control that, then you'll need to see on what port will the device connect to the IP, and put a dedicated server on that IP where you develop your own communication protocol with the device. – Dan Bizdadea May 19 '15 at 14:56