Kelkoo Signing Requests
In order to access the web Services you must first sign your URLs. The
signing process checks whether you are authorized to use the web services.
To
sign a URL you will use your client Id and secret key.
You will find below the same function, in coldfusion MX, that will create the URLs. All you have to do is fill in your information.
<!--- Key provided by Kelkoo --->
<cfset key = "xxxxxxxx">
<!--- Partner ID provided by Kelkoo --->
<cfset URL_partner = "0000000">
<!--- --->
<cfset urlDomain = 'http://nl.shopping.yahooapis.com'>
<!--- The path below lists the main category from Kelkoo --->
<cfset urlPath = '/V2/categorySearch?category=601&shortcuts=false&features=None&format=List'>
<!--- get the timestamp --->
<cfset time = left(GetTickCount(),10)>
<!--- remove spaces from string --->
<cfset urlPath = replace(urlPath,' ','+','all')>
<!--- format temporarely URL --->
<cfset URLtmp = "#urlPath#×tamp=#time#&aid=#URL_partner#">
<!--- URL needed to create the tokken --->
<cfset s = "#URLtmp##key#">
<!--- base64_encode(pack('H*', md5($s))) --->
<!--- use Java's MessageDigest class to create the Hash --->
<cfset digest = CreateObject("java", "java.security.MessageDigest")>
<cfset digest = digest.getInstance("MD5")>
<cfset result = digest.digest(s.getBytes("ISO-8859-1"))>
<cfset resultStr = ToBase64(result)>
<!--- Replace some characters --->
<cfset resultStr = replace(resultStr,'+','.','all')>
<cfset resultStr = replace(resultStr,'/','_','all')>
<cfset resultStr = replace(resultStr,'=','-','all')>
<!--- Final url --->
<cfset URLreturn = "#urlDomain##URLtmp#&hash=#resultStr#">
<cfhttp method="get" url="#URLreturn#" timeout="8"/>
Best,
Harry Kuperus
http://www.comparum.eu
Reacties