last.fm API Url Builder


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function apiSig($vars)
  2. {
  3. ksort($vars);
  4. $sig = "";
  5. foreach ( $vars as $n => $v )
  6. $sig .= $n.$v;
  7. $sig .= $GLOBALS["apiSecret"];
  8. //echo "<h1>".$sig.$GLOBALS["apiSecret"]."</h1>";
  9. return md5($sig);
  10. }
  11.  
  12. function builtUrl($vars, $sig)
  13. {
  14. $url = $GLOBALS["apiRootUrl"] . "?";
  15. foreach ($vars as $n => $v)
  16. $url .= $n . "=" . $v . "&";
  17. if($sig==1)
  18. $url .= "api_sig=".apiSig($vars);
  19. return $url;
  20. }

URL: http://www.lastfm.de/api

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.