| Version 4 (modified by Tuinslak, 3 years ago) (diff) |
|---|
API MySQL logging
Requirements
MySQL server (tested on 5.0.90)
Setting up the database
Create a new database (e.g. iraildb), with login credentials (e.g. irailuser:qe4teKaNuwr5t6eth4VE) Using PhpMyAdmin or the command line, import the SQL file found here in the database you just created.
Setting up the API-DB config
Rename dbConfig.example.php to dbConfig.php, and edit the variables (if you imported the file above, you'll only need to edit your db name, username and password.
Testing
Request following two files (at the time of writing) to see if it's logging:
- api/trains.php?from=Brugge&to=vilvoorde&lang=EN
- api/connections.php?from=Brugge&to=vilvoorde&lang=EN
And check whether your database is filling up.
That should be it.
Note
As there is no limit to the SQL inserts, you'll probably want to empty the table every now and then; especially if there are lots of requests. If you are not interested in logging, please comment the writeLog function found in trains.php and connections.php (at the time of writing). For example:
writeLog($_SERVER['HTTP_USER_AGENT'],"", "", "Error in connections.php: " . $e, $_SERVER['REMOTE_ADDR']);
Why not Google Analytics?
The XML files have no real (HTML/JS) output. And thus we cannot use GA for logging.
