Created
February 20, 2011 16:49
-
-
Save nissuk/836092 to your computer and use it in GitHub Desktop.
Services_Amazonで音楽のベストセラー情報を取得する例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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