PHP Sript for displaying amazon astore content does not work - need help, please

Discussion in 'PHP' started by hpgoodboy, Apr 12, 2010.

  1. #1
    This script works somewhat, but when I click on a category, nothing happends.

    An example is here:
    http://www.aufsteckbürsten-kaufen.de/

    On the right side below "Stöbern" you find the category:
    Mehr von Braun Oral B

    If you click on it nothing happens.
    When I click on it, the page should look like this:
    http://astore.amazon.de/braun-oral-b-aufsteckbursten-21?_encoding=UTF8&node=15

    You can see how it should behave here:
    http://astore.amazon.de/braun-oral-b-aufsteckbursten-21

    The code used is:

    <?php
    $myshop = "http://astore.amazon.com/ASTORE_ID";
    function getTheShop($myshop) {
    $url = $_SERVER['QUERY_STRING'];
    $url = explode("linkurl=index.php&linkurl=",$url);
    if (strpos($url[1],"&") == true) {
    $url[1] = strrchr($url[1],"/");
    if (strpos($url[1],"?") == true) { $url[1] = strrchr($url[1],"?"); }
    else $url[1] = strchr($url[1],"&"); $url[1] = substr_replace($url[1],"?",0,1);
    $shopid = explode("/",$myshop);
    $url[1] = $shopid[3].$url[1]; }
    else { }
    if ($url[1]=="") {
    $var['content'] = file_get_contents($myshop);
    $var['extra'] = ' SOME TEXT'; }
    else
    $var['content'] = file_get_contents("http://astore.amazon.com/".$url[1]);
    return $var;
    }
    
    function getMetaTitle($content){
    $pattern = "|<[\s]*title[\s]*>([^<]+)<[\s]*/[\s]*title[\s]*>|Ui";
    if(preg_match($pattern, $content, $match))
    return $match[1];
    else
    return false;
    }
    
    $content = getTheShop($myshop);
    $extra = $content['extra'];
    $content = preg_replace("/\/\d{3}\-\d{7}\-\d{7}/", "", $content['content']);
    // $content = $content['content'];
    $tabletext = explode('alt="',$content);
    
    for($i = 0; $i < count($tabletext); $i++) { $tabletext[$i] = substr($tabletext[$i], 0, strpos($tabletext[$i], '"')); }
    $title = getMetaTitle($content);
    $title = explode(" - ",$title);
    
    $content = explode("</title>",$content);
    unset($content[0]);
    $content = implode("</title>",$content);
    $content = str_replace('action="', ' action="http://astore.amazon.com', $content);
    $content = str_replace('</title>', '', $content);
    $content = str_replace('<title>', '', $content);
    $content = str_replace('</body>', '', $content);
    $content = str_replace('</html>', '', $content);
    $content = str_replace('<body>', '', $content);
    $content = str_replace('<html>', '', $content);
    $tiler = substr (strrchr ($content, '<body>'), 0);
    ?>
    <!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" xml:lang="en" lang="en">
    <head>
    <title><?php echo "Buy ".$title[1]." in our Shop. ".$title[0]." - ".$title[1] ?></title>
    <meta name="description" content="<?php echo "You search ".$title[0]."? Look around, we provide ".$title[0]." - ".$title[1] ?>" />
    <meta name="keywords" content="<?php echo $title[1].", ".$title[0].", "; for($i = 8; $i < 18; $i++) { echo trim($tabletext[$i]).", "; } ?>" />
    <meta name="robots" content="index,follow" />
    <meta name="revisit-after" content="1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <center>
    <?php echo trim($content);
    echo '<br style="clear:both;" />';
    echo $extra; ?>
    
    <TRACKING CODE>
    </center>
    </body>
    
    </html> 
    PHP:

    And here is the htaccess file:
    Options +FollowSymlinks
    
    RewriteEngine On
    
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !\.html$
    RewriteRule ^(.*)$                     index.php?linkurl=$1 [qsappend,L]
    Code (markup):
    Please tell me (or better show me) how to fix this.
     
    hpgoodboy, Apr 12, 2010 IP
  2. webcasher

    webcasher Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi! I have exactly the same problem. I saw that you solved this - so could you tell my how you got it working? Thank you in advance!
     
    webcasher, Aug 23, 2011 IP