Amazon API を使える PEAR :: Services_Amazon の ItemSearch を使って、複数キーワードでの検索をしてみました。
・参考:Docs For Class Services_Amazon
ItemSearch の使い方サンプルは以下のようになっています。
1
2
3
4
5
6
7
8
9
10
11
| <?php
$amazon = new Services_Amazon('[your Access Key ID here]', '[your Secret Access key here]');
$options = array();
$options['Keywords'] = 'sushi';
$options['ResponseGroup'] = 'ItemIds,ItemAttributes,Images';
$result = $amazon->ItemSearch('Books', $options);
?> |
<?php
$amazon = new Services_Amazon('[your Access Key ID here]', '[your Secret Access key here]');
$options = array();
$options['Keywords'] = 'sushi';
$options['ResponseGroup'] = 'ItemIds,ItemAttributes,Images';
$result = $amazon->ItemSearch('Books', $options);
?>
これの $options[‘Keywords’] の部分を下記のようにすれば、「書籍名」「著者名」「出版社名」と複数のキーワードで検索できます。
1
2
3
4
5
| $title = '検索したい書籍名';
$author = '検索したい著者名';
$publisher = '検索したい出版社名';
$options['Keywords'] = $title . $author . $publisher; |
$title = '検索したい書籍名';
$author = '検索したい著者名';
$publisher = '検索したい出版社名';
$options['Keywords'] = $title . $author . $publisher;
このとき、キーワードに含まれる「書籍名」「著者名」「出版社名」は、検索時にAmazon側での区別はされていません。
Amazonには、これらの文字列3つを連結した文字列の内容で検索しています。
以上です。