Web Design Forum: Adding TD affiliate clicktag to kelkoo API request PHP - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Adding TD affiliate clicktag to kelkoo API request PHP Rate Topic: -----

#1 User is offline   keith115 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 244
  • Joined: 06-March 10
  • Reputation: 5
  • Gender:Male
  • Location:UK
  • Experience:Intermediate
  • Area of Expertise:Entrepreneur

Posted 07 March 2010 - 01:07 AM

Hi as title says adding TD affiliate clicktag to kelkoo API request PHP

iv managed to get kelkoo API feed to bring up what i want and how i want but im now left with adding TD click tag to track clicks/earnings

this is the code so far

<?
$affiliateid = '******'; //Letters and numbers
$trackingid = '******'; //numbers only
function UrlSigner($urlDomain, $urlPath, $partner, $key){
            settype($urlDomain, 'String');
            settype($urlPath, 'String');
            settype($partner, 'String');
            settype($key, 'String');
            $URL_sig = "hash";
            $URL_ts = "timestamp";
            $URL_partner = "aid";
            $URLreturn = "&url";
            $URLtmp = "";
            $s = "";
            $time = time();
            $urlPath = str_replace(" ", "+", $urlPath);
            $URLtmp = $urlPath . "&" . $URL_partner . "=" . $partner . "&" . $URL_ts . "=" . $time;
            $s = $urlPath . "&" . $URL_partner . "=" . $partner . "&" . $URL_ts . "=" . $time . $key;
            $tokken = "";
            $tokken = base64_encode(pack('H*', md5($s)));
            $tokken = str_replace(array("+", "/", "="), array(".", "_", "-"), $tokken);
            $URLreturn = $urlDomain . $URLtmp . "&" . $URL_sig . "=" . $tokken;
            return $URLreturn;
            }
$request = simplexml_load_file(UrlSigner('http://uk.shoppingapis.kelkoo.com', '/V2/productSearch?query=xbox 360&show_products=1&show_subcategories=0&show_refinements=0&logicalType=and&start=1&results=8&merchantId=', $trackingid, $affiliateid));

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kelkoo iPod Banner Example</title>
<style type="text/css">
<!--
body,td,th {
    font-size: 10px;
}
-->
</style></head>

<body>
<center>
<table width="970" border="0" cellpadding="1"><tr>
<? 
foreach ($request->Products->Product as $details) {

    $GridImage = $details->Offer->GridImage->Url;

    $Url = $details->Offer->Url; 
    
     echo '<td width="160" valign="top" style="border:0;"><a href="'.$Url.'" target="_blank"><img src="'.$GridImage.'" style="float:;border:0; margin-left:10px;" alt="'.$ProductName.'" title="'.$ProductName.'" height="80" width="90"/></a>'.$ProductName.'<br /><span style="color:#ffffff; font-weight:bold;">'.$Price.'</span></td>';
}
    
    
//echo '<pre>';
//print_r($request);
//echo '</pre>';
?></tr></table>

</body>
</html>


Now this brings up so the url's are http ://uk.shoppingapis.kelkoo.com(then the merchant link)

i need to add the click tag http ://clk.tradedoubler.com/click?p=****&a=****** somewere so it brings up the url's like this

http ://clk.tradedoubler.com/click?p=****&a=*****&url=uk.shoppingapis.kelkoo.com(then the merchant link)

iv tried afew things and best i got was change <a href="'.$Url.'" target="_blank">

to

<a href="http ://clk.tradedoubler.com/click?p=****&a=*****&url='.$Url.'" target="_blank">

but this brings up the url with an extra http://

http: //clk.tradedoubler.com/click?p=****&a=*****&url=http ://uk.shoppingapis.kelkoo.com(then the merchant link)

does anyone know if im putting it in the correct place or if im to add/remove something ?

any help would be great

Thank you
0

#2 User is offline   keith115 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 244
  • Joined: 06-March 10
  • Reputation: 5
  • Gender:Male
  • Location:UK
  • Experience:Intermediate
  • Area of Expertise:Entrepreneur

Posted 08 March 2010 - 04:09 PM

May of solved it by adding/replacing $Url with substr($Url, 7) like so

<a href="http://clk.tradedoubler.com/click?p=****&a=*****&url='.substr($Url, 7),'" target="_blank">


not sure yet if work but the urls/links are showing correctly to how TD said they should

im hoping this problem is solved.
0

#3 User is offline   keith115 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 244
  • Joined: 06-March 10
  • Reputation: 5
  • Gender:Male
  • Location:UK
  • Experience:Intermediate
  • Area of Expertise:Entrepreneur

Posted 09 March 2010 - 05:04 PM

Seems to be working fine, just out of interest for the future how could i have it say 6 items down instead of across ? or 2 across by 6 down

Cheers
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users