割とよくできてる
すぐ動かすサンプル
$service = new Zend_Service_Amazon($apiKey, $countryCode, $secretKey);
$resultSet = $service->itemSearch(array(
'SearchIndex' => 'All',
'Keywords' => null,
'Operation' => 'ItemSearch',
'ResponseGroup' => 'Medium',
));
foreach ($resultSet as $item){
var_dump($item);
}
アダルトを除外する
if ($item->Format == 'アダルト')
で、ある程度いけるけど、まだ漏れるやつがある。
isAdultProduct要素があるという情報もみかけるけど、そんなの返ってこない!
と思ったらこんなスーパーすごい方法が。
http://pgman.exblog.jp/4279054/
その方法は、検索キーワードに「-アダルト」を含めるだけ。
これでかなり除去できるし、検索時にフィルタリングできて便利!
$itemの中身はこんなの
object(Zend_Service_Amazon_Item)[1519]
public 'ASIN' => string 'B001F0Q8KA' (length=10)
public 'DetailPageURL' => string 'http://www.amazon.co.jp/%E3%83%9E%E3%83%AB%E3%83%A8%E3%82%B7-%E3%83%89%E3%83%A9%E3%81%88%E3%82%82%E3%82%93%E3%83%9E%E3%83%AB%E3%83%81%E3%83%9D%E3%83%BC%E3%83%81/dp/B001F0Q8KA%3FSubscriptionId%3DAKIAJSFZNPYCKRLY5NAA%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB001F0Q8KA' (length=304)
public 'SalesRank' => int 635
public 'TotalReviews' => null
public 'AverageRating' => null
public 'SmallImage' =>
object(Zend_Service_Amazon_Image)[1534]
public 'Url' =>
object(Zend_Uri_Http)[1531]
protected '_username' => string '' (length=0)
protected '_password' => string '' (length=0)
protected '_host' => string 'ecx.images-amazon.com' (length=21)
protected '_port' => string '' (length=0)
protected '_path' => string '/images/I/41lZKGU5YTL._SL75_.jpg' (length=32)
protected '_query' => string '' (length=0)
protected '_fragment' => string '' (length=0)
protected '_regex' =>
array
...
protected '_scheme' => string 'http' (length=4)
public 'Height' => int 56
public 'Width' => int 75
public 'MediumImage' =>
object(Zend_Service_Amazon_Image)[1521]
public 'Url' =>
object(Zend_Uri_Http)[1529]
protected '_username' => string '' (length=0)
protected '_password' => string '' (length=0)
protected '_host' => string 'ecx.images-amazon.com' (length=21)
protected '_port' => string '' (length=0)
protected '_path' => string '/images/I/41lZKGU5YTL._SL160_.jpg' (length=33)
protected '_query' => string '' (length=0)
protected '_fragment' => string '' (length=0)
protected '_regex' =>
array
...
protected '_scheme' => string 'http' (length=4)
public 'Height' => int 120
public 'Width' => int 160
public 'LargeImage' =>
object(Zend_Service_Amazon_Image)[1530]
public 'Url' =>
object(Zend_Uri_Http)[1527]
protected '_username' => string '' (length=0)
protected '_password' => string '' (length=0)
protected '_host' => string 'ecx.images-amazon.com' (length=21)
protected '_port' => string '' (length=0)
protected '_path' => string '/images/I/41lZKGU5YTL.jpg' (length=25)
protected '_query' => string '' (length=0)
protected '_fragment' => string '' (length=0)
protected '_regex' =>
array
...
protected '_scheme' => string 'http' (length=4)
public 'Height' => int 376
public 'Width' => int 500
public 'Subjects' => null
public 'Offers' =>
object(Zend_Service_Amazon_OfferSet)[1522]
public 'LowestNewPrice' => int 924
public 'LowestNewPriceCurrency' => string 'JPY' (length=3)
public 'LowestUsedPrice' => null
public 'LowestUsedPriceCurrency' => null
public 'TotalNew' => int 1
public 'TotalUsed' => int 0
public 'TotalCollectible' => int 0
public 'TotalRefurbished' => int 0
public 'Offers' => null
public 'CustomerReviews' =>
array
empty
public 'SimilarProducts' =>
array
empty
public 'Accessories' =>
array
empty
public 'Tracks' =>
array
empty
public 'ListmaniaLists' =>
array
empty
protected '_dom' =>
object(DOMElement)[1491]
public 'CurrencyCode' => string 'JPY' (length=3)
public 'Amount' => int 924
public 'FormattedPrice' => string '¥ 924' (length=7)
public 'Binding' => string 'おもちゃ&ホビー' (length=24)
public 'Brand' => string 'マルヨシ' (length=12)
public 'EAN' => string '4571132845181' (length=13)
public 'Label' => string 'マルヨシ' (length=12)
public 'Manufacturer' => string 'マルヨシ' (length=12)
public 'ManufacturerMinimumAge' => string '72' (length=2)
public 'ProductGroup' => string 'Toy' (length=3)
public 'Publisher' => string 'マルヨシ' (length=12)
public 'ReleaseDate' => string '2008-11-29' (length=10)
public 'Studio' => string 'マルヨシ' (length=12)
public 'Title' => string 'ドラえもんマルチポーチ' (length=33)