Use of Amazon APIs

Source: Internet
Author: User
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.