Print Reseller Scheme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

best way to diplay PHP/API feed without iframe.

Discussion in 'Website Design Forum:' started by keith115, Mar 30, 2010.

  1. keith115

    keith115 Member

    basically as the tittle says, i have got an API feed in PHP and im currently showing it in an iframe across the site, yes i know its not best practice, im now looking to get rid of the iframes due to some people not been able to see it and slows the page load.

    Thank you
     
  2. keith115

    keith115 Member

    This may help, this is basically the php that i show in an iframe as a banner at the moment.

    Code:
    PHP Code: <?$affiliateid = '........'; //Letters and numbers$trackingid = '.........'; //numbers onlyfunction 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 = ""; $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=ipod&show_products=1&show_subcategories=0&show_refinements=0&logicalType=and&start=1&results=6&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: 12px;}--></style></head><body><table width="960" border="1" cellpadding="5"><tr><? foreach ($request->Products->Product as $details) { $ProductName = $details->Offer->ProductName; $GridImage = $details->Offer->GridImage->Url; $Price = $details->Offer->Price; $Url = $details->Offer->Url;  echo '<td width="160" valign="top" style="border:0;"><a  href="'.$Url.'"><img src="'.$GridImage.'"  style="float:left;border:0; margin-right:1px;" alt="'.$ProductName.'"  title="'.$ProductName.'" height="90"  width="90"/></a>'.$ProductName.'<br /><span  style="color:#FF0000;  font-weight:bold;">&pound;'.$Price.'</span></td>';}  //echo '<pre>';//print_r($request);//echo '</pre>';?></tr></table></body></html>
     
  3. Sunburn

    Sunburn Active Member

    div + ajax :)
     
  4. keith115

    keith115 Member

    Hi sunburn, i have got it to work by removing the doc type, html, head, body, and placing the rest of code in the page with a few tweaks, this works for 2 of my areas/sub domain but sadly not on another that uses smarty.
     

Share This Page