Data collection with the GIS unit is set up on the ‘Login settings page’:
http://aplogin.com/admin/loginpage.cgi
This information can be sent to an email address, or sent to be processed by a script running on your
server.
This script can be written in many different web-based languages, however the below basic example is
done using PHP.
The data is sent by HTTP POST from the GIS unit when the user presses the ‘Connect & agree’ button to
the URL you provide on the ‘Login settings page’. The URL should be the location on your server of the
script you are using to make use of this data.
An example would be:
http://www.myserver.com/example.php
The following data is sent:
Up to 3 key/value pairs defined on the login settings page. key = name defined on Login settings page
Login time/date key/value pair key = “LOGIN”
Hotspot ID key/value pair key = “HOTSPOT_ID”
MAC address key/value pair key = “MAC_ADDRESS” (if selected)
Browser type key/value pair key = “BROWSER” (if selected)
These are all contained in the $_POST array.
You can access the key/value pairs in the $_POST array by requesting the value using the “key”. This is
done with the following:
$_POST[“key”];
Where “key” is an example key of a key/value pair.
This can be passed to a variable with the following:
$example_variable = $_POST[“key”];
$example_variable now contains the value associated with the key value pair of the given key. This
variable can now be used as you wish, e.g. to pass to your database.
You can also get a dump of all the information from the $_POST array using the following:
var_export($_POST, true);
Or
var_dump($_POST);
The following example takes the $_POST information and passes each value from the key/value pairs to
variables, and also does a var_export of the $_POST to see all the data contained within it.
It then appends these variables to a text file located in the same directory as the php script, so you can
easily see the output.
<?php
//set variable $file to be the text file located on server
$file = 'test.txt';
//set variables to take the value of $_POST based on the "key" given for that value
$name = $_POST["Name"]; //name set by user
$age = $_POST["Age"]; //name set by user
$favorite_colour = $_POST["FavoriteColour"]; //name set by user
$login = $_POST["LOGIN"];
$hotspotID = $_POST["HOTSPOT_ID"];
$mac = $_POST["MAC_ADDRESS"]; // Needs to be selected on login settings page
$browser = $_POST["BROWSER"]; // Needs to be selected on login settings page
//Exports all the key/value pairs from $_POST
$all = var_export($_POST, true);
//Append the values of the above variables to a file $file
file_put_contents($file, "Name:$name\n
Age:$age\n
Favourite Colour:$favorite_colour\n
Login:$login\n
Hotspot ID:$hotspotID\n
MAC address:$mac\n
Browser:$browser\n\n
Everything from the var_export $all\n\n\n" , FILE_APPEND | LOCK_EX);
//The End
?>
This should write something similar to the following to the test.txt file located in the same
directory as the PHP script:
Name:Mike
Age:25
Favourite Colour:Blue
Login:2015-08-03 07:36:33
Hotspot ID:152axxx
MAC address:00:00:00:00:00:00
Browser:Linux/Firefox
Everything from the var_export array (
'LOGIN' => '2015-08-03 07:36:33',
'HOTSPOT_ID' => '152axxx',
'Name' => 'Mike',
'Age' => '25',
'FavoriteColour' => 'Blue',
'MAC_ADDRESS' => ‘00:00:00:00:00:00’,
'BROWSER' => 'Windows/Firefox',
)
This is not very easy to read, nor very useful, however it shows the basic concept of receiving the
information from the GIS unit and saving it to your server to then make use of.
Rather than printing these variables to a text file you can pass them to your database and use them as
you wish to provide analytical data about your users and their internet usage.