私が欲しいのは、同じページに返される次のようなものだけです:
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) リクエストを認証しながらリクエストを送信する