Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $affiliateid = 'zc9ig2Ef'; //Letters and numbers
- $trackingid = '96945214'; //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 = "";
- $URLtmp = "";
- $s = "";
- // get the timestamp
- $time = time();
- // replace " " by "+"
- $urlPath = str_replace(" ", "+", $urlPath);
- // format URL
- $URLtmp = $urlPath . "&" . $URL_partner . "=" . $partner . "&" . $URL_ts . "=" . $time;
- // URL needed to create the tokken
- $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;
- }
- $querySearch = array("iPhone","Nokia+Lumia","iPhone+5","Nexus+5","Samsung+Galaxy+S4","sony+xperia","HTC");
- $randQuery = rand(0, count($querySearch)-1);
- $request = simplexml_load_file(UrlSigner('http://it.shoppingapis.kelkoo.com', '/V3/productSearch?query=iphone&category=100020213&sort=default_ranking&results=12&show_subcategories=0&show_refinements=0', $trackingid, $affiliateid));
- ?>
- <table style="width:100%; border:0; cellspacing:2px; cellpadding:2px; align:center">
- <?php
- $result_counter = 12;
- for( $i=0; $i < $result_counter; ++$i ) {
- foreach ($request->Products->Product as $details) {
- $Title = $details->Offer->Title;
- $Image = $details->Offer->Images->Image->Url;
- $Url = $details->Offer->Url;
- $Price = $details->Offer->Price->Price;
- }
- if ($i % 3 == 0) {
- echo "<tr>";
- }
- echo '<td style="width:25%"><table style="width:100%; border:0; cellspacing:2px; cellpadding:2px; align:center">';
- echo '<tr>';
- echo '<td style="text-align:center; valign:top">';
- echo '<a href="http://clk.tradedoubler.com/click?p=48396&a=1820567&url='.str_replace('&', "&", $Url[$i]).'" target="_blank" title="Prezzi Cellulari" rel="nofollow"><img src="'.$Image[$i].'" style="border:0; width:60; height:60" alt="Prezzi Cellulari" /></a>';
- echo '</td></tr><tr>';
- echo '<td style="width:85%; text-align:center; height:1; valign:top">';
- echo '<a class="linkadv" href="http://clk.tradedoubler.com/click?p=48396&a=1820567&url='.str_replace('&', "&", $Url[$i]).'" target="_blank" rel="nofollow" title="'.$Title[$i].'">'.substr(str_replace(array(',','+','/'),array(", "," + "," / "),$Title[$i]." ..."), 0, 20).'</a>';
- echo '</td></tr><tr>';
- echo '<td style="width:85%; height:19; text-align:center; valign:bottom">';
- echo '<b>€ '.$Price[$i].'</b></td>';
- echo '</tr>';
- echo '</table></td>';
- if($i % 3 == 2) {
- echo '</tr>';
- }
- }
- ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement