LastfmWSClient
                                
                                
                                
                                    LastfmWSClient copied to clipboard
                            
                            
                            
                        Simple Last.fm WS Client
Copyright (c) 2010 Last.fm.
Features:
- Full support for GET, POST, auth
 - takes your API_KEY, API_SECRET and API_SK (session key) from env - so you can put it in .bashrc
 
Installation notes:
Please note this is not currently compatible with PHP 8. Use PHP 7.
If you have proper PHP PEAR set up then you only need ./client.php. The other files are usually installed by "pear install". But, they're here because it makes things easy.
Setup:
- First, put your API_KEY and API_SECRET into the environment (you can find them at http://www.last.fm/api/account) $ export API_KEY=xxxxxxxxxxxx $ export API_SECRET=xxxxxxxxxx
 - Now, use the client to get a token $ php ./client.php GET --method=auth.getToken
 - Authorise that token at http://www.last.fm/api/auth/?api_key=API_KEY&token=TOKEN (change the API_KEY and TOKEN)
 - Now, use the client to get a session key $ php ./client.php GET --method=auth.getSession --token=TOKEN
 - Now you can take the Session key and put it in API_SK: $ export API_SK=xxxxxxxxxxx This key should be infinite.
 - Finally, put all 3 export lines into ~/.bashrc
 
Examples:
Simple example: artist.getInfo (works without API_SK) $ php ./client.php GET --method=artist.getInfo --artist=Radiohead
Logged in example: update your now playing track (requires API_SK) $ php ./client.php POST --artist="Weather Report" --method=track.updateNowPlaying --track="Man In The Green Shirt"