Skip to content

Instantly share code, notes, and snippets.

@robertcedwards
Created November 18, 2012 06:34
Show Gist options
  • Save robertcedwards/4103888 to your computer and use it in GitHub Desktop.
Save robertcedwards/4103888 to your computer and use it in GitHub Desktop.
Alpha LED sign Foursquare Check-ins
<?php
$checkin = stripslashes($_POST["checkin"]);
$val = json_decode($checkin);
$firstname = $val->user->firstName;
$lastname = $val->user->lastName;
$display = $firstname . " " . $lastname . " just checked in! Welcome, " . $firstname . "!";
$display = urlencode($display);
// I'm using +++ to indicate the start of the string and &&& to indicate the end for now
// I plan on writing Arduino code to interpret GET parameters so that it can be more
// easily ported for other uses.
$url = "http://ARDUINO_ADDRESS_HERE/+++" . $display . "&&&";
$str = file_get_contents($url);
$myFile = "logFile.txt";
$fh = fopen($myFile, 'a');
$checkin .= "\n\n";
fwrite($fh, $checkin);
fclose($fh);
echo "OK";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment