Return to Snippet

Revision: 23069
at January 29, 2010 08:04 by bionickid


Initial Code
function apiSig($vars)
{
    ksort($vars);
    $sig = "";
    foreach ( $vars as $n => $v )
    $sig .= $n.$v;
    $sig .= $GLOBALS["apiSecret"];
    //echo "<h1>".$sig.$GLOBALS["apiSecret"]."</h1>";
    return md5($sig);
}

function builtUrl($vars, $sig)
{
    $url = $GLOBALS["apiRootUrl"] . "?";
    foreach ($vars as $n => $v)
    $url .= $n . "=" . $v . "&";
    if($sig==1)
    $url .= "api_sig=".apiSig($vars);
    return $url;
}

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

Initial Description

                                

Initial Title
last.fm API Url Builder

Initial Tags
php, api

Initial Language
PHP