Thursday, October 10, 2013

Whereabouts Software, Part 3 - Fetch Current

The PHP script that is called by the Arduino looks into the database and grabs the most recent locations for each user.  It then returns the data in an XML output that the Arduino can parse.

Here's the source code:  fetch_current.php

You will need to update the following with your own server data:

// Database connection information
$db_hostname = "localhost";
$db_username = "db_username";
$db_password = "db_password";
$db_database = "whereabouts";

When executed with `php fetch_current.php` you should receive output similar to this:

<?xml version="1.0" encoding="ISO-8859-1"?>

The clock will use the user names and locations to move the hands to the appropriate places.

No comments:

Post a Comment