
Amazonのアフィリエイト用WEBサービスの名前が、「Amazon Associates Web Service 4.0」から「Amazon Product Advertising API」と変更となり、さらには、今後は使用するのに署名認証が必要となりました。
いままで使っていたマッシュアップや、WEBサービスのスクリプトを変更する必要があります。
私の場合、PHPのPEARライブラリでしたAWSを使用していなかったので、比較的簡単に移行することができました。
まず、スクリプトの変更の前に、新しい署名認証のための「Secret Access Key」を取得する必要があります。
まず以下にアクセスします。
そこで、下図のように「Your Account」から、「Access Identifiers」を選択します。

すると、下図のように、「Access Key ID」と「Secret Access Key」が表示されますので、それをメモします。
ではいよいよスクリプト側の変更です。
まず、この記事ではPEARライブラリを使っていることが前提ですので、PEARのAmazonライブラリをアップデートします。
以下のようにPearコマンドを打ちます。
# pear upgrade Services_Amazon-beta
私の場合、以下のように他の依存するパッケージもアップデートされました。
# pear upgrade Services_Amazon-beta WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update Did not download optional dependencies: pear/Cache, use --alldeps to download automatically WARNING: "pear/Net_URL" is deprecated in favor of "pear/Net_URL2" downloading Services_Amazon-0.8.0.tgz ... Starting to download Services_Amazon-0.8.0.tgz (20,992 bytes) ........done: 20,992 bytes downloading PEAR-1.8.1.tgz ... Starting to download PEAR-1.8.1.tgz (290,382 bytes) ...done: 290,382 bytes downloading HTTP_Request-1.4.4.tgz ... Starting to download HTTP_Request-1.4.4.tgz (17,109 bytes) ...done: 17,109 bytes downloading XML_Serializer-0.20.0.tgz ... Starting to download XML_Serializer-0.20.0.tgz (40,245 bytes) ...done: 40,245 bytes downloading Archive_Tar-1.3.3.tgz ... Starting to download Archive_Tar-1.3.3.tgz (18,119 bytes) ...done: 18,119 bytes downloading XML_Util-1.2.1.tgz ... Starting to download XML_Util-1.2.1.tgz (17,729 bytes) ...done: 17,729 bytes downloading Net_Socket-1.0.9.tgz ... Starting to download Net_Socket-1.0.9.tgz (5,173 bytes) ...done: 5,173 bytes downloading XML_Parser-1.3.2.tgz ... Starting to download XML_Parser-1.3.2.tgz (16,260 bytes) ...done: 16,260 bytes upgrade ok: channel://pear.php.net/Archive_Tar-1.3.3 upgrade ok: channel://pear.php.net/XML_Util-1.2.1 upgrade ok: channel://pear.php.net/Net_Socket-1.0.9 upgrade ok: channel://pear.php.net/PEAR-1.8.1 upgrade ok: channel://pear.php.net/HTTP_Request-1.4.4 upgrade ok: channel://pear.php.net/XML_Parser-1.3.2 upgrade ok: channel://pear.php.net/XML_Serializer-0.20.0 upgrade ok: channel://pear.php.net/Services_Amazon-0.8.0 PEAR: Optional feature webinstaller available (PEAR's web-based installer) PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) PEAR: To install optional features use "pear install pear/PEAR#featurename"
Amazonのライブラリが、0.8.0にアップデートされました。
AmazonのPEARライブラリの詳細については下記を参照してください。
では、PHP側の変更です。
以前のECS4では以下のように記述していました。
require_once 'Services/AmazonECS4.php'; $amazon = new Services_AmazonECS4( ACCESS_KEY_ID, 'アソシエイトID' );
これを以下のように変更します。
require_once 'Services/Amazon.php'; $amazon = new Services_Amazon( ACCESS_KEY_ID, SECRET_ACCESS_KEY, 'アソシエイトID' );
Services/AmazonECS4.phpが、Services/Amazon.phpになっていることにも注意です。
これでアクセスできれば、変更完了です!
参考URL
こちらの記事もあわせてどうぞ!
- Newer: 今週の管理人Bookmark (6/21-6/28)
- Older: このブログ、携帯でも見ることができます
Comments:2
- myositomi 2009/08/22 23:58
-
大変参考になりました。
無事に署名認証を実装できることができました。 - showBOO 2009/08/23 7:58
-
>myositomi さん
参考になれば幸いです。
Trackbacks:1
- Trackback URL for this entry
- http://www.multiburst.net/ElectricBrain/2009/06/amazon-product-advertising-api-pear/trackback
- Listed below are links to weblogs that reference
- Amazon Product Advertising APIへ対応する(PEAR) from ElectricBrain Standard
- trackback from 倉鉢徹のサイエンス館 09-09-15 (火) 14:32
-
PHP×WebサービスAPIコネクションズ例題を変更
秋元氏のWebAmazonAPIサンプルが動くように修正



