0

私が欲しいのは、同じページに返される次のようなものだけです:

8.91% 割引

小売価格: $599.00

価格: $549.99

合計節約額: $49.01

私は PHP をよく知らないので、ドキュメントを追うのに非常に苦労しました。署名プロセスを理解しようとして数時間行き詰まりました。私はそれを理解していると思います、それはあなたの身元を認証するために使用されるセキュリティ機能です. また、SHA-1 ハッシュとして保存されるため、それを理解するには何らかの関数が必要です。もちろん、私の場合は、言うは易く行うは難しです。

しかし、フォーム入力を伴う ItemSearch 操作を使用しているため、とにかくドキュメントにある例よりもはるかに単純です。これはより簡単に思えます。

このプロセスを説明しようと思いますが、私の理解が間違っている場合は修正してください。PHP スクリプトが実行され、特定の詳細について Amazon 製品 API にリクエストが送信され、ユーザーが認証されて、必要なデータが何らかの変数で返され、その変数が XML に解析されますか? 次に、javascript を使用してその XML を解析し、同じページに表示される HTML DOM に配置します。

これでおおよそでしょうか。いいえ?

では、これを実際にコードに変換するにはどうすればよいでしょうか。

私が読んでいるリソース: http://www.kennylucius.com/a/AAWS_signed_URL_function

docs.amazonwebservices.com/AWSECommerceService/latest/DG/RequestAuthenticationArticle.html

docs.amazonwebservices.com/AWSECommerceService/2011-08-01/GSG/ImplementinganA2SRequest.html

わかりましたので、signedURL を介してリクエストを作成するのは簡単です...そして、スタイルを設定できる XML で探しているものを返します。しかし、PHPでそれを行うにはどうすればよいですか? API ライブラリを簡単に説明する、もう 1 つの役立つリソースを見つけました。

codediesel.com/php/accessing-amazon-product-advertising-api-in-php/

その記事とドキュメントから、これが一般的なプロセスであると思います。

1) リクエストを含むオブジェクトを作成する

2)リクエストに必要なさまざまなパラメーターを追加します

3) リクエストを認証しながらリクエストを送信する

4

1 に答える 1

1

I wrote or at least improved a bunch of code to access the Amazon Product API. The latest version is in GitHub, it was part of my web mashup codebase.

It has methods such as:

  • public function getItemByUpc($upc_code, $product_type)
  • public function getItemByAsin($asin_code)
  • public function getItemAttributesByAsin($asin_code)
  • public function getRelatedItemsByAsin($asin_code)
  • public function getRelatedTracksToAsin($asin_code)
  • public function getItemByKeyword($keyword, $product_type)
  • public function getMP3sForAlbumByArtist($albumTitle, $artist)
  • public function getMP3ForSongByArtist($songTitle, $artist)
  • public function getBookForKeyword($keyword)
  • public function getAlbumCoverByArtistAndTitle($artist, $title)
  • public function getInfoForSongwriter($artist)
  • public function getDVDCoverByTitle($title)
  • public function getDVDCoverByTitleAndDirector($title, $director)

Based on those examples and the various helper methods that do the heavy lifting you should be able to get most anything Amazon lets you get nowadays from the Amazon Product API. They don't give you everything, direct links to MP3 previews no longer seems to work (be possible). The documentation perhaps isn't the best, you need to understand Response Groups and Categories and the difference between and ItemSearch and an ItemLookUp sometimes you have to make multiple queries to get all the information. I've written a lot of code to access the Amazon Product API, check it out it is based on Sameer's code, I think he rolled in some of my changes/fixes/additions but not all. Different people try to get different information out of the API...

于 2013-03-12T03:38:25.343 に答える