Wednesday, December 20, 2006

Amazon astore code: php to include astore

Below is the absolute basics of a php include script to include an amazon astore into your own site:

=========index.php==========

<?php


$url=$url2."/".$url3;

ob_start();

function replace_for_mod_rewrite(&$s) {


$s = str_replace("</title>","</title><base href='http://astore.amazon.co.uk/'>
",$s);

$s = str_replace("a href=\"/YOURID-21/detail/","a
href=\"http://www.YOURDOMAIN/page/YOURID-21/detail/",$s);

return $s;


}




include("http://astore.amazon.co.uk/YOURID-21/".$url);


?>




<?

$contents = ob_get_contents(); // store buffer in $contents




ob_end_clean(); // delete output buffer and stop buffering


echo replace_for_mod_rewrite($contents); //display modified buffer to screen


global $dbg_starttime;

?>

=======end=index.php===========


===========.htaccess file===========

Options +FollowSymLinks
rewriteEngine on
rewriteBase /
RewriteRule ^page/(.*)/(.*)/(.*)/(.*)$ index.php?url=$1&url2=$2&url3=$3

=======end = .htaccess file===========

demo store: - http://www.flavour-shaker.co.uk/
This site is for a .co.uk amazon astore - but should work for a .com / .ca etc astore.
Code is just a snippet and may not work on all servers. no warrentees etc.

Let me know if you find this useful

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home