Anda di halaman 1dari 15

How to send GPS data using HTTP to a web site

This article is for developers who wants to post GPS data to his own web site using HTTP.

GpsGate 2.5.0 build 207 (and later) can send GPS data over http. Any web server can
receive and process the position data sent to it.

Please follow those steps to configure GpsGate.


1. Start GpsGate
2. Open the Settings dialog
3. Go to the Output tab
4. Add a "GpsGate.com (Send)" plugin.
5. Click on "..." (or "More Options..." in the 2.6 Windows version)
6. Change the "Protocol" to "HTTP".
7. Set "Server" to your web server address E.g. www.myaddress.com
8. Set the "File path" to the script address. E.g. /gpsgate.php if /gpsgate.php is the page on
your web server to process the requests. Do not forget the first "/".
8. Click OK
9. Now configure in which intervals you want GpsGate to send data to your web site.
10. Click OK.

URL format
The URL posted will have the following parameters:
longitude=34.2333&latitude=23.2222&altitude=34.0&speed=30.3&heading=234.5&date=2
0070529&time=123445.234&username=myuser&pw=encryptedpassword

longitude: Decimal degrees (WGS84)


latitude: Decimal degrees (WGS84)
altitude: Above sea level in meters.
speed: Speed over ground in knots
heading: Heading in degrees. 0 is north, 90 is east, 180 is south, 270 is west.
date: UTC data in the format: YYYYMMDD
time: UTC time in the format: HHMMSS.sss
username: The username specified.
password: The password specified with a simple encryption. The encryption/decryption
algorithm can be found here:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=5638

End user deployment


All configuration in GpsGate are stored in XML files ending with the extension .ggXML, you
can use those files for simpler configuration. If you prepare one ggXML file and copy it to
the "Chains" folder in the GpsGate root directory, you can have a menu option with your
settings ready in GpsGate!

GpsGate for Windows will also allow you to install a ggxml file over the web by clicking on it
in a browser (this feature will soon be available in the PPC version as well). In this way you
can provide a link to the ggxml file which contains the configuration to send data to your
website.

Additional info
Note that you can also send data over TCP/IP and UDP using the "GpsGate.com (Send)"
PlugIn.
When you select to send data to another server, no data will be sent to GpsGate.com

Regards,
Johan

Franson Support

tonyh
New Member

5 Posts

Posted - 07/08/2007 :  15:54:31    

Tack så mycket Johan! Your service is incredible. I wish to express my gratitude by


including some of my PHP Server-Side Code for the benefit of all of your GPS Gate
customers who want to create dynamic Web services.

(This code is made available per GNU-GPL and, as such, no warranties or support is
included or implied.)

Cheers,
Tony

<?
// SYNOPSIS: Demonstration Consumption of REST HTTP Parameters from
// Franson GPSGate in to create simple XML database of position
//
// IMPLEMENTATION NOTES: Server-side: Tested with PHP 5.x on
// IIS server with IE client. Client-side: Tested with Franson
// GPSGate v2.5.0.207 on PC running Windows XP SP2.
// You need to create an empty placeholder file named
// position.xml in the same Web-accessible directory
// as this file (consumeGPSGate.php). Must grant "modify"
// permissions to position.xml on sever. Use your Web browser to
// view position.xml to get the latest position after
// GPSGate posts the HTTP REST parameters to this
// file (consumeGPSGate.php). Limitations: Currently stores
// only one position based on intervals set at GPSGate client.
//
// REDISTRIBUTION: Buy a Franson GPSGate License and feel free to
// use this code per GNU GENERAL PUBLIC LICENSE (GNU - GPL) Version 3.0
// http://www.gnu.org/licenses/gpl-3.0.txt
//
// Thank you Johan and the rest of the franson.com team for helping
// me out!...8 July 2007 - Tony in San Diego (tonyh on franson.com forum)

//----------------------------------------------
// Use dummy date to prevent caching of Web page and force refresh
//----------------------------------------------
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");

//----------------------------------------------
// Set content type for XML
//----------------------------------------------
header("Content-type:text/xml");

//----------------------------------------------
// REST HTTP Parameters
//----------------------------------------------
// Decimal Degrees - WGS1984 Datum
$lat = $_GET["latitude"];
$lon = $_GET["longitude"];

// meters above sea level


$alt_m = $_GET["altitude"];

// knots
$vel_kt = $_GET["speed"];

// Degrees
$head = $_GET["heading"];

// UTC - YYYYMMDD
$date = $_GET["date"];

// UTC - HHMMSS.sss
$time = $_GET["time"];

$user = $_GET["username"];
$pwd_encry = $_GET["pw"];

//----------------------------------------------
// SI - English Conversions
//----------------------------------------------
// Feet above sea level
$alt_ft = 3.2808399 * floatval($alt_m);

// Miles per hour


$vel_mph = 1.15077945 * floatval($vel_kt);
//----------------------------------------------
// Date - time parsing and RFC 822 date creation
//----------------------------------------------
// Set timezone to UTC
date_default_timezone_set("UTC");

$year = substr($date, 0, 4);


$month = substr($date, 4, 2);
$day = substr($date, 6, 2);
$hour = substr($time, 0, 2);
$minute = substr($time, 2, 2);
// Decimal seconds truncated
$second = substr($time, 4, 2);

// RFC 822 Format: "Day, DD MMM YYYY HH:MM:SS UTC"


$date_RFC822 = date(DATE_RFC822, mktime($hour, $minute, $second, $month, $day, $year));

//----------------------------------------------
// Simple dynamic generation of XML document
//----------------------------------------------
// Declare new XML document
$dom = DOMDocument::loadXML('<positiondatabase/>');
$dom->preserveWhiteSpace = false;
$dom->encoding = "UTF-8";

// documentElement refers to the root element!


$positiondatabase = $dom->documentElement;

// Web 2.0 Metadata for reusability using W3 geo:lat and geo:long namespace standards
$positiondatabase-
>setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:geo','http://www.w3.org/2003/01/geo/wgs84_pos#');

// Declare individual XML elements


$position = $dom->createElement("position");
$geolat = $dom->createElementNS("http://www.w3.org/2003/01/geo/wgs84_pos#","geo:lat",$lat);
$geolong = $dom->createElementNS("http://www.w3.org/2003/01/geo/wgs84_pos#","geo:long",$lon);
$alt_meters = $dom->createElement("altitude_m",$alt_m);
$alt_feet = $dom->createElement("altitude_ft",$alt_ft);
$vel_knots = $dom->createElement("velocity_kt",$vel_kt);
$vel_milesperhour = $dom->createElement("velocity_mph",$vel_mph);
$heading = $dom->createElement("heading_deg",$head);
$date_time = $dom->createElement("date_rfc822",$date_RFC822);
$username = $dom->createElement("user_name",$user);
$pwd_encryted = $dom->createElement("user_pwd_encrypt",$pwd_encry);

// Inserting individual XML elements

// append child nodes to root element


$dom->documentElement->appendChild($position);

// append grandchild nodes to child elements


$position->appendChild($geolat);
$position->appendChild($geolong);
$position->appendChild($alt_meters);
$position->appendChild($alt_feet);
$position->appendChild($vel_knots);
$position->appendChild($vel_milesperhour);
$position->appendChild($heading);
$position->appendChild($date_time);
$position->appendChild($username);
$position->appendChild($pwd_encrypted);

//----------------------------------------------
// XML Output Processing
//----------------------------------------------
// Save new XML file output
$output = $dom->save('position.xml');

// Make output readable


$dom->preserveWhitespace = false;
$dom->formatOutput = true;

// Print XML file output to client display


print $dom->saveXML();
?>

jpalten
Starting Member

1 Posts

Posted - 11/29/2007 :  03:56:15    

Will this also work with the normal,main,global gpsgate.com server? Can my application use
this interface to send my position to my buddies?

johan
Forum Admin

Sweden
10759 Posts

Posted - 11/29/2007 :  04:24:50      

Yes, that will work.

Please download "GpsGate.com Client SDK" it has a PDF document which in detail with
samples describes how you can send data from a client to GpsGate.com or GpsGate Server:
http://franson.com/gpsgateserver/download.asp

You can send data using TCP/IP, UDP and HTTP. The TCP/IP protocol is very interesting
since it support device configuration and track buffering on the client side.

Regards,
Johan

Franson Support

deputydave
Junior Member

USA
11 Posts

Posted - 12/12/2007 :  15:04:08      

I am trying to access this page on my 8125 PDA http://deputydave.com/minimap.html what


am I missing?

sweber
Starting Member

Denmark
1 Posts

Posted - 04/20/2008 :  02:52:57    

Hi All

Following the instructions for setting up gpsgate accessing my own php script on myown
server. I end up with the error message 404. This usually means that there is something
wrong in the url and the url can not be found.
I am using the http protocol, after step 8 I will have the following in the server line
"http://myserver.domain.xx/php/gate.php".
myserver.domain.xx is not the correct server name
Executing the test in gpsgate will give the above mentioned error.

Pasting the url above into a browser will give the result I expect, a response from the script
gate.php.

If I use default settings and send to gpsgate.com with a usercode/password, I get the
correct answer that the usercode/password are invalid.
hope someone can point me in the right direction.
Steen

johan
Forum Admin

Sweden
10759 Posts
Posted - 04/20/2008 :  06:21:57      

Please follow those steps:

1. Open the GpsGate Settings dialog. Go to the "Output" tab


2. Check "Connect to custom GpsGate Server"
3. Click on "More options..."
4. Select HTTP as Protocol.
5. Enter "http://myserver.domain.xx/php/gate.php" as Server address and click OK
6. Click Next in the Wizard. Enter username / password and then "Finish"

You can also verify the connection by clicking "Test".

Regards,
Johan

Franson Support

unicptz
New Member

6 Posts

Posted - 05/15/2008 :  06:30:03    

All works with custom server, but when I reboot my ppc or exit gpsgate and start again all
my properties (server name, protocol, mobile) don't save and become initial.

johan
Forum Admin

Sweden
10759 Posts

Posted - 05/15/2008 :  06:44:02      

This can be because of the language used on your device. Which language is it? Which
country are you from?

We have made some improvements on this in the latest release. But there are still some
problem when file paths cannot be saved as Latin-1 characters.

Regards,
Johan

Franson Support
unicptz
New Member

6 Posts

Posted - 05/15/2008 :  16:32:14    

Russian. Windows mobile 5.0


The URL is "http://www.domain.ru/gps/getdata.php"

johan
Forum Admin

Sweden
10759 Posts

Posted - 05/16/2008 :  03:58:44      

Yes, there is some problems to save Unicode paths in the settings files. We are aware of
this limitation, and will try to fix it as soon as possible.

Try the latest version (build 321) it should improve things, and be less likely to fail saving
the settings, even though it doesn't solve all known problems related to this.

Regards,
Johan

Franson Support

bveldkamp
New Member

2 Posts

Posted - 05/27/2008 :  08:27:50    

Does GpsGate support basic or digest authentication when sending data to an http server?

johan
Forum Admin
Sweden
10759 Posts

Posted - 05/27/2008 :  08:31:01      

No, you need to authenticate the request using the username + password you get in the
URL.

Regards,
Johan

Franson Support

rudykstra
New Member

2 Posts

Posted - 06/09/2008 :  14:00:09    

First of all, many thanks for this fantastic and stable program. I tried earlier versions which
wouldn't work quite right, but this one is wordth every penny (or Euro)

My question;

I'm usig gps-gate client to send my position by HTTP to my own database. I've tried it for a
day with an interval of 5 minutes. When I came home i found the interval to be quite big
when I'm driving fast. However, for my occupation I have to wander (survey) distances of
about 5 kilometrs per day and I want this logged as well. Therefore it is not a suitable
option for me to switch to the 'log every fixed distance' option.

Can you tell me how big (how much data) the HTTP-calls to my database (website) are? If I
know the amount of data a request aqcuires, I can calculate the most efficient settings for
the interval.

Thanks in advance and kind regards,

Ruurd Dijkstra

johan
Forum Admin

Sweden
10759 Posts

Posted - 06/10/2008 :  04:31:55      

The HTTP request is about 0.5 kB.


The reason you miss position updates when driving fast can be that GPRS will not always
work completely stable when roaming between base stations, something that happens often
when driving fast. The result will be that data is lost and some HTTP requests fails.

If no data may be lost you need to use the TCP/IP options which can handle bad
connections without loosing data. It will also consumke less band width, but it will not work
with a web server.

Regards,
Johan

Franson Support

unicptz
New Member

6 Posts

Posted - 07/09/2008 :  05:11:37    
quote:

Originally posted by johan

Yes, there is some problems to save Unicode paths in the settings files. We are aware of this limitation, and will try to fix it
as soon as possible.

When are you going to solve this problem?

johan
Forum Admin

Sweden
10759 Posts

Posted - 07/09/2008 :  09:03:27      

We don't have a fix yet, but it is on our radar.

Regards,
Johan

Franson Support
unicptz
New Member

6 Posts

Posted - 07/09/2008 :  17:11:51    
quote:

Originally posted by johan

We don't have a fix yet, but it is on our radar.

Thanks.

Maybe is it possible to write properties directly to file in program's directory?

menq
New Member

China
2 Posts

Posted - 08/03/2008 :  21:42:46    

thanks!

bveldkamp
New Member

2 Posts

Posted - 09/04/2008 :  05:06:22    

Are there any plans to support proper authentication? Personally I'd like to have NTLM, but
basic or digest would be a nice start.

If not, are there any known workarounds?

Regards, Berend

quote:

Originally posted by johan


No, you need to authenticate the request using the username + password you get in the URL.

Regards,
Johan

Franson Support

johan
Forum Admin

Sweden
10759 Posts

Posted - 09/04/2008 :  05:55:31      

No plans for the moment, but thanks for your feedback! We'll consider this for coming
releases of GpsGate Client.

Regards,
Johan

Franson Support

selphi81
New Member

2 Posts

Posted - 10/29/2008 :  04:37:58    

7. Set "Server" to your web server address E.g. www.myaddress.com


8. Set the "File path" to the script address. E.g. /gpsgate.php if /gpsgate.php is the page on
your web server to process the requests. Do not forget the first "/".
------------------------------------------------------------------
hi,i can't find "File path" in the 2.6 version,and the "server address" following
"/GpsGate.aspx " can't delete.I'm looking foward to your support,thanks!

johan
Forum Admin

Sweden
10759 Posts

Posted - 10/29/2008 :  06:49:32      

Click on "More options..." next to the field where you enter the server address. Select
"HTTP" as protocol.

Regards,
Johan

Franson Support

selphi81
New Member

2 Posts

Posted - 10/30/2008 :  00:48:51    

thanks a lot for your support!

sputnik2006
New Member

United Kingdom
7 Posts

Posted - 11/21/2008 :  17:12:49    
quote:

Originally posted by johan

How to send GPS data using HTTP to a web site

This article is for developers who wants to post GPS data to his own web site using HTTP.

GpsGate 2.5.0 build 207 (and later) can send GPS data over http. Any web server can receive and process the position
data sent to it.

Please follow those steps to configure GpsGate.

7. Set "Server" to your web server address E.g. www.myaddress.com


8. Set the "File path" to the script address. E.g. /gpsgate.php if /gpsgate.php is the page on your web server to process
the requests. Do not forget the first "/".
8. Click OK
9. Now configure in which intervals you want GpsGate to send data to your web site.
10. Click OK.

Don't understand step 7 and onwards, how can I do this?

Regards
johan
Forum Admin

Sweden
10759 Posts

Posted - 11/22/2008 :  14:01:24      

In the first step in the Wizard click on "More Options..." then select HTTP as protocol.

Regards,
Johan

Franson Support

bksi
New Member

Bulgaria
2 Posts

Posted - 02/26/2009 :  09:23:59    

Hi, all. This is very nice service, but I have one problem. The local service on
http://localhost:12175/ does not return any coordinates on my mobile device. I'm using
windows mobile v6. What would be the problem? I tried this html on IE and Opera mobile.

johan
Forum Admin

Sweden
10759 Posts

Posted - 02/26/2009 :  10:12:54      

Pocket IE will not work. Opera Mobile will work.

Regards,
Johan

Franson Support

EXXHAL
Starting Member

1 Posts
Posted - 06/20/2009 :  01:38:42      

Hello,

WHen i use my website server, where 2 get or what is the password and username i have 2
use there.

I get a 404 at random name and passw.

Luis MS
New Member

3 Posts

Posted - 08/28/2009 :  11:31:13    

Hi i´m new on these and i have a question, in order to be able to send information from a
vehicle tracker application yo need to have the gpsgate server installed on your server or it
can be done if i just have the subscription?

Best Regards

Luis

johan
Forum Admin

Sweden
10759 Posts

Posted - 08/28/2009 :  11:57:50      

You can fetch positions from a GpsGate hosted or self hosted server using "SOAP Platform
Kit". More info here:
http://franson.com/forum/topic.asp?TOPIC_ID=8097

(Please start a new Topic for new questions.)

Regards,
Johan

Franson Support

Anda mungkin juga menyukai