When the phone clients send gps data to the website to be stored in the database, you’ll notice that all of the clients use the Http GET method instead of POST. Most experienced developers would look at that and immediately think it was a mistake and I am one of them. GET is used to get data such as getting a list or getting user data and POST is used to add a new item to a collection or in the case of Gps Tracker, adding a new row of gps data to the database.
But there’s one important difference between GET and POST that I am taking advantage of. GET requests are sent in the URL string while POST requests are sent as part of the Http message body. I get quite a lot of requests for help in setting up Gps Tracker and the easiest way to debug setup problems is to open up a browser and send data to their website by pasting a URL like this:
https://www.websmithing.com/gpstracker/UpdateLocation.aspx?longitude=-122.0214996&latitude=47.4758847&extrainfo=0&username=momo&distance=0.012262854&date=2014-09-16%2B17%253A49%253A57&direction=0&accuracy=65&phonenumber=867-5309&eventtype=android&sessionid=0a6dfd74-df4d-466e-b1b8-23234ef57512&speed=0&locationmethod=fused
If I were trying to debug Gps Tracker using POST, I would have to use a tool like curl or wget from the command line to send the data to the website. It’s a lot more work for me to ask people to use curl or wget instead of just pasting the URL into their browser and that’s the reason why Gps Tracker uses GET.
But generally speaking, you should be using POST when you are adding new rows to a database.
Nick,
Have you considered using PHP’s $_REQUEST array instead of $_GET? This would allow GET and POST http methods.
Brent
Brent
I wasn’t aware that $_REQUEST could be used for both. Yes, it would be better to use that.
n
Hello Nick and friends of the forum, I would like to consult with some of you if you know why I only recognize a single cell, when I try to connect another information does not reach the bd, if anyone knows I would greatly appreciate it. thank you very much to all.
It works fine with multiple phones sending locations. Check to make sure you typed in the URL in the phone app correctly.