: This article mainly introduces the use of Amazon API. For more information about PHP tutorials, see. As mentioned above, a Japanese friend wants
ShopAsk me to help him with a small application. The main function he wants to achieve is to regularly obtain the lowest price of a product. if the price is not within his set range, give it to him.
Send emailReminder.
To help me complete the program, he also found a Japanese blog to show me how to use Amazon APIs. The principle is to concatenate a URL through a complex set of rules, access the URL to obtain data in the XML format returned by Amazon, and then obtain the expected product price intelligence. When I directly downloaded and read the official documentation of Amazon, I found a more labor-saving method. In fact, Amazon has provided users with a convenient website through which they can customize their own query content and directly query or generate code. This website name is Amazon Scratchpad (this shows the settings for Japan and Asia. to query China's Amazon, you only need to change the Marketplace to China ).
The settings are as follows:
The generated code is as follows:
Save the generated code to a method (for example, generateURL). The last few lines of the code must be slightly corrected, use the final generated url as the return object of the method instead of echo), and then use this method as follows.
$ Url = generateURL ($ asin); $ responseXML = file_get_contents ($ url); $ parsedXML = simplexml_load_string ($ responseXML );
The above introduces the use of Amazon API, including opening a shop and sending emails. I hope my friends who are interested in the PHP Tutorial will be helpful.