Skip to content

Instantly share code, notes, and snippets.

Last active January 16, 2017 04:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dedenf/5097395 to your computer and use it in GitHub Desktop.
php script to fetch your last listened track on lastfm, an you can add this to your hooks or commit message $(lasfm)
$url = "";
// Initializing curl
$ch = curl_init($url);
$options = array(
CURLOPT_HTTPHEADER => array('Content-type: application/json')
curl_setopt_array( $ch, $options );
$result = curl_exec($ch);
$decode = json_decode($result, true);
$track = $decode['recenttracks']['track'];
echo "commiting the code while listening to ".($track['artist']['#text'] ." - ". $track['name'] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment