Posted By

bionickid on 01/29/10


Tagged

php api lastfm


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

voove


last.fm API Url Builder


 / Published in: PHP
 

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

  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. }

Report this snippet  

You need to login to post a comment.