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 Coding & Programming Forum:' started by keith115, Mar 30, 2010.

  1. keith115

    keith115 Member

    As the title 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.

    Any suggestions?

    Thank you
     
  2. You could potentially place it within a div which has a set height with an overflow so that it's scrollable but it may or may not work in ie6. Just an idea though as it certainly get's rid of the iframe.

    Jonathan
     
  3. keith115

    keith115 Member

    Hi, thanks for the reply, i will post what i have been asked on another forum that may help better

    this is basically the php that i then show on site by iframe as a banner.

    Code:
    PHP Code: <?
    $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 = "";
    $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>
     

Share This Page