Skip to content

Instantly share code, notes, and snippets.

@nissuk
Created February 20, 2011 16:49
Show Gist options
  • Save nissuk/836092 to your computer and use it in GitHub Desktop.
Save nissuk/836092 to your computer and use it in GitHub Desktop.
Services_Amazonで音楽のベストセラー情報を取得する例
<?php
require_once 'Services/Amazon.php';
// Product Advertising APIのアカウントを作成し、
// https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key
// からアクセスキーなどの情報をコピーしてきます。
$access_key = ''; // 上記URLのアクセスキーID
$access_key_secret = ''; // 上記URLのシークレットアクセスキー
$browse_node_id = '562032'; // Music
$amazon = new Services_Amazon($access_key, $access_key_secret);
$amazon->SetLocale('JP');
$result = $amazon->BrowseNodeLookup($browse_node_id, array(
'ResponseGroup' => 'TopSellers',
));
foreach ($result['BrowseNode']['TopItemSet']['TopItem'] as $item) {
$artist = isset($item['Artist']) ? $item['Artist'] : $item['Actor'];
echo $artist, ' - ', $item['Title'], PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment