As mentioned above, a Japanese friend wants to open a
shop in Amazon and ask me to do a little app for him. The main function He wants to achieve is to regularly get the lowest price of a product, and if the price is not within his set, send him an
email alert.
To help me complete the program, he also found me a Japanese blog that describes how to use the Amazon API. Its principle is to use a complex set of rules to stitch a URL, and then access the URL to obtain the Amazon returned XML format data, and then get the desired commodity price information. When I downloaded and read the official Amazon documents, I found a more effort-saving approach. In fact, Amazon has provided users with a convenient website, through which they can customize their own query content, directly query or generate code. This site is named Amazon Scratchpad (this shows the settings for Nichia, if you need to query China Amazon, just change marketplace to Chinese).
The Setup section is as follows:
The resulting code is represented as follows:
Save the generated code in a method (for example, called GenerateURL, the last few lines of code need a little correction, the resulting URL as the return object of the method instead of Echo), and then use the same method as below.
$url = GenerateURL ($asin), $responseXML = file_get_contents ($url); $parsedXML = simplexml_load_string ($responseXML);
The above describes the use of the Amazon API, including the opening of the store, send the content of the message, I hope that the PHP tutorial interested in a friend to help.