Session and cookies in file parser

Discussion in 'PHP' started by Gniuz, Feb 2, 2010.

  1. #1
    Hi,

    First, pardon me is this question seems stupid. I'm really a newbie programmer.

    I want to run my Amazon astore
    http://astore.amazon.com/singapproperc-20/

    on my own domain name cheapdesk.net . So what I do is create a htaccess file to redirect all URL in cheapdesk.net to index.php

    And here is the index.php
    
    <?php
    $site_name = "CheapDesk.Net";
    $site_domain = "www.cheapdesk.net";
    $site_folder_name = "/";
    $astore_amazon_domain = "astore.amazon.com";
    $astore_folder_name = "/singapproperc-20";
    
    $current_URL = $_SERVER["REQUEST_URI"];
    
    $my_file = file_get_contents("http://".$astore_amazon_domain. $astore_folder_name.$current_URL);
    
    $my_new_file = str_replace($astore_folder_name, "" , $my_file);
    
    echo $my_new_file;
    
    ?>
    Code (markup):
    So apparently the code works to redirect all the URL and to my own domain name. However, when I add an item to the shopping cart, the button doesn't work. There is no item added to the shopping cart.

    There must be a way to do this correctly, because even proxy provider like hidemyass can properly add items to the cart. So is a third party service storebrander.com.

    Here is the site using the script above cheapdesk.net (without www) and here is the version using storebrander service www.cheapdesk.net
     
    Gniuz, Feb 2, 2010 IP
  2. Bec0de

    Bec0de Well-Known Member

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    115
    #2
    Its better to create an iframe for this:
    
    <html>
    <head>
    <title>Place your Title here</title>
    <style type="text/css">
    html {overflow: auto;}
    html, body, div, iframe {margin: 0px; padding: 0px; height: 100%; border: none;}
    iframe {display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden;}
    </style>
    </head>
    <!-- Amazon Store frame -->
    <iframe src="http://astore.amazon.com/singapproperc-20/" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"></iframe>
    <!-- Amazon Store iframe end -->
    </body>
    </html>
    
    HTML:
     
    Bec0de, Feb 2, 2010 IP
  3. Gniuz

    Gniuz Peon

    Messages:
    126
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    IFrame can't do what I need. I want my pages to be indexed as my own pages. If this works, I intend to add contents to each pages such as review, comments, etc so it can be indexed by search engines.
    But I need to get the add cart to work first.
     
    Gniuz, Feb 2, 2010 IP
  4. Unregistered

    Unregistered Peon

    Messages:
    155
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What you are trying to do is actually quite an advanced form of programming. You can check out proxy techniques using PHP.
     
    Unregistered, Feb 3, 2010 IP
  5. Gniuz

    Gniuz Peon

    Messages:
    126
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for the reply, Unregistered. I checked your site. Am I right to assume that StoreBrander is actually using your script?
     
    Gniuz, Feb 4, 2010 IP
  6. Unregistered

    Unregistered Peon

    Messages:
    155
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hey Gniuz,

    No not really, though our "scripts" are kind-of similar. StoreBrander is more of a service while aStore Script is a product (PHP script / software) where you download and install on your server.
     
    Unregistered, Feb 5, 2010 IP