<?php
require"Services/AmazonECS4.php";
$subscription = 'xxxxxxxxxxxx';
if($_GET['asin']){
$asin = $_GET['asin'];
}else{
$asin = '4798108766';
}
if( $_GET[aid] ){
$aid = $_GET['aid'];
}else{
$aid = 'hatena-22';
}
$amazon = new Services_AmazonECS4( $subscription, $aid );
$amazon -> setLocale('JP');
$option = array( 'ResponseGroup'=>'Small,Images' );
$result = $amazon -> ItemLookup ($asin,$option );
$similarity = $amazon -> SimilarityLookup($asin);
if( PEAR::isError($result) ){
die ( $result -> message );
}else{
foreach( $similarity['Item'] as $item ){
print $item["ItemAttributes"]["Title"] . "<br>\n";
}
print $result['Item'][0]['ItemAttributes']['Title'];
print '<img src="';
print $result['Item'][0]['MediumImage']['URL'];
print '" alt="">';
}
?>