Aspicore GSM Tracker
Real-Time GPS Tracking with Series 60 Smartphone
PHP Tools
Utilities and sample PHP scripts to create a server end, which accepts data
from Aspicore GSM Tracker mobile clients, optionally stored into SQL
database and sends some feedback.
These scripts can be used, when Aspicore GSM Tracker uses HTTP protocol for communication.
Reporting scripts listsql.php and queryphone.php can also be used, when the
location data has been uploaded with UDP protocol.
Uploading location data with HTTP requires Aspicore GSM Tracker v2.00 or above
or an S80 version. (Download S60 SIS from
here, updated 2006-04-05. Version
2.xx supports HTTP protocol to upload the location data to the server, in
addition to the UDP protocol used in the earlier versions. Version 2.xx
requires that the phone operating system is based on Series 60 platform 2.0
or above. If your Series 60 phone is not compatible, you get
"Series60Product ID Required" error, when trying to install the SIS file.
Series 80 SIS is here.)
PHP Tools can be used with or without a database. Compatible with MySQL
4.1.10.
Run in a computer, which should be connected to the Internet
with a public IP and should have web server software running, e.g. Apache or
Microsoft IIS. The computer must have PHP installed. We recommend v5.0.3
or newer. For Windows, you can download PHP from
PHP web site (choose PHP zip package
instead of PHP Windows installer, if you want to use the MySQL extension
php_mysqli.dll.).
You can use these scripts as a demonstration, how to handle Aspicore GSM
Tracker http data
at the server end, even if you are not going to use PHP and MySQL. You could
e.g. convert these scripts for Microsoft IIS ASP pages and Microsoft SQL
Server or Access database, if that is the technology you prefer to use.
Download
Download PHP tools here.
(12 kB Zip file, contains listsql.php, queryphone.php,
showargs.php, storedata.php, storentrack.php and storesql.php)
MySQL related scripts and info
here.
(6 kB Zip file,
contains GSM_Tracker_MySQL_tab.sql, GSM_Tracker_MySQL.txt, select.pl,
insert.pl, delete.pl. Only the first two are needed for PHP.)
Below is an explanation for the files, that you find within the
downloaded Zip files.
Tool to test HTTP round-trip communication
| File name |
Description |
showargs.php
|
Show URL arguments as plain text.
This sample demonstrates, how Aspicore GSM Tracker sends location data to the server via HTTP.
Usage: Set "Internet page URL" in Aspicore GSM Tracker settings to point to this page.
You see the output in your phone in the Info tab every time the phone sends
some location data to the server via a HTTP connection.
|
Tool to store HTTP location data into text file
| File name |
Description |
storedata.php
|
Show URL arguments as plain text and stores data into text file.
(The data is written to C:/PHP/uploadtemp/storedata.txt by default.)
Usage: Set "Internet page URL" in Aspicore GSM Tracker settings to point to this page.
You see the output in your phone in the Info tab every time the phone sends
some location data to the server via a HTTP connection.
|
Tool to store HTTP location data into SQL database
You must create the MySQL database first before you can use any of the
SQL related PHP scripts below. See section "Files to create and test the
SQL database".
See the comment in the beginning of storesql.php source about enabling
the mysqli extension in your PHP installation. The sample scripts make use
of this "Improved MySQL Extension".
Make sure to set the mysqli_connect parameters in the source files as
required by your database settings (host, username, passwd, dbname). Look
for the line beginning with $link =
| File name |
Description |
storesql.php
|
Show URL arguments as plain text and store data into MySQL database.
For simplicity, this script stores GPS data only.
You can amend it to store also the cell tower info into another SQL table.
(See storesql.asp on our ASP samples
page.)
Usage: Set "Internet page URL" in Aspicore GSM Tracker settings to point to this page.
You see the output in your phone in the Info tab every time the phone sends
some location data to the server via a HTTP connection.
Example of the response:
|
listsql.php
|
You can use this sample to see, what data storesql.php has stored into the database.
Usage: Go to the URL of this page with your Internet browser,
e.g. http://<YourWebServer>/listsql.php
|
queryphone.php
|
You can use this sample to see, what data exists in the database for a certain phone.
Usage: Go to the URL of this page with your Internet browser,
e.g. http://<YourWebServer>/queryphone.php?imei=<your_imei>
Example
of the response
|
storentrack.php
|
Store data into MySQL database and track a friend.
This is an example, how can make complex calculations in the server and send the results back to the client.
This shows, how flexible Aspicore GSM Tracker is. You can customize it yourself for various purposes by modifying
the script at the web server end. The script results are sent back to mobile phone as a compact plain text file
in a HTTP response message. (A curiosity: if the response contains a BEL character, Aspicore GSM Tracker makes a beep.)
Usage: Set "Internet page URL" in Aspicore GSM Tracker settings to point to this page.
You see the output in your phone in the Info tab every time the phone sends
some location data to the server via a HTTP connection. You can force
the phone to send data immediately with menu Options -> GPRS data ->
Send current position.
If you have entered an IMEI code of your friends phone
into the TRACK_PHONE field in the PHONE table,
the script calculates your friend's distance and bearing (direction) from your current location.
The script also shows a snapshot of the tracked phone database data.
The user can check from this data, how fresh the location information is and is it reliable (GPS status field).
Also the course and speed of the tracked phone can be observerd.
(You must use e.g. MySQL Command Line Client to maintain data in the PHONE table.)
Example of the response:
|
Files to create and test the SQL database
| File name |
Description |
GSM_Tracker_MySQL_tab.sql
|
Database creation SQL script for table GPS. |
GSM_Tracker_MySQL.txt
|
Instructions how to create the database gsmtrack and run the script GSM_Tracker_MySQL_tab.sql. |
select.pl
|
Make a SQL SELECT from MySQL database gsmtrack.
(You need Perl v5.8.0 or newer to run this.) |
insert.pl
|
Make a SQL INSERT to MySQL database gsmtrack.
(You need Perl v5.8.0 or newer to run this.) |
delete.pl
|
Delete all records from the GPS table in the MySQL database gsmtrack.
(You need Perl v5.8.0 or newer to run this.) |
Installation
- Install database engine (MySQL 4.1.10 or above)
- Install a PHP compatible web server (Apache or Microsoft IIS)
- Install PHP v5.0.3 or newer. Remember to activate the mysqli
extension.
- Create database by executing the SQL scripts.
- Copy Aspicore PHP files into sum public folder in your web server.
- Edit Aspicore PHP files to set the mysqli_connect parameters in the source files as
required by your database settings (host, username, passwd, dbname).
- Go to the URL
http://localhost/showargs.php?myarg=dummy with your Internet browser
to see that your PHP installation works. (Modify the URL to point to
the folder where copied
showargs.php).
- If you see in your browser something like:
Thu, 07 Apr 2005 09:58:59
Array
(
[myarg] => dummy
)
your setup works at least locally.
- Repeat the same test from public Internet to make sure that the PHP
page is accessible also from your phone.
- Configure the Internet Access Point in your phone, if necessary. More
info
here.
- Start Aspicore GSM Tracker v2.00 in your phone. Goto
Options->Settings->http. Set HTTP Protocol -> On and Internet page URL ->
http://www.yourdomain.com/php/showargs.php?
Press Back to save the settings.
- Choose Options->GPRS data->Connect GPRS
- Choose Options->GPRS data->Send GPRS test msg
- Activate the Info tab in Aspicore GSM Tracker. Soon you should see the
server reply:

Now your setup is ready and you can continue with the other sample
scripts, which store data into your server.
Obviously you need to write or purchase some additional program code to
do something with the positioning data collected to the database.
Please contact support@aspicore.com,
if you have questions or suggestions. You can also use our
discussion forum.
If you have written the receiving part for our GSM tracker with a different language than
PHP and
allow us to share your code free of charge to the other users, we would appreciate any such source code you can send
us by e-mail or via our discussion forum. Open source C#, ASP VBScript and
Python solutions were especially interesting.
N.B. See also our Asp, Perl and
Java samples.
Back to product main page
|