Skip to content

Instantly share code, notes, and snippets.



Last active Jan 16, 2017
What would you like to do?
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