Welcome to the Kelkoo Group Customer Service

Signing URL – Perl

This example illustrates how to sign request URL’s using Perl.


Name Type Summary
$urlDomain string (required) URL of the service (ex: http://uk.shoppingapis.kelkoo.com)
$urlPath string (required) Path and query for the service (ex: /V3/productSearch?query=ipod)
$partner string (required) Affiliate Id
$key string (required) Affiliate secret key

Please note that your query must be encoded if you use characters with accents.

Sample Code

use Digest::MD5 qw(md5_base64);
use URI::Escape;

sub UrlSigner {
    my ($urlDomain, $urlPath, $partner, $key) = @_;

    # get the timestamp
    my $time = time;

    # replace " " by "+" in url path
    $urlPath =~ s/\s/+/g;

    # format URL
    my $URLtmp = $urlPath . "&aid=" . $partner . "&timestamp=" . $time;

    my $tokken = md5_base64($URLtmp . $key) . '--';
    $tokken =~ tr/+\/=/._-/;

    return $urlDomain . $URLtmp . "&hash=" . $tokken;

# Simply call the function to generate the appropriate URL (tracking "1234" and key "myPartnerKey")
my $query = UrlSigner("http://ru.shoppingapis.kelkoo.com", "/V3/productSearch?query=".uri_escape("Мода")."&sort=default_ranking&start=1&results=20&show_products=1&show_subcategories=1","1234", "myPartnerKey");