It’s interesting to see the Taobao API, and I’ll learn the PHP tutorial by the way
http://open.taobao.com/
After looking at the API calling method, it is to assemble the URL and then send an http request to interact with the server
See here for the specific principles: http://open.taobao.com/dev/index.php/Quick Start Guide
Look at the official demo, there are two types: using SDK and not using SDK. I don’t like SDK and can’t see the mechanism of background implementation
Look at the code of PHP without SDK: http://open.taobao.com/dev/index.php/php%e8%b0%83%e7%94%a8%e7%a4%ba %e4%be%8b%e4%bb%a3%e7%a0%81
util.php
There are two functions in it, one to generate md5 signature and one to assemble url
Then call these two functions according to the parameters, send http requests, and process the returned results
I probably understand the principle, just copy and paste and run it
Paste the code and run it. . . http 500 error. . .
This is embarrassing, I am also a beginner in PHP, so I have to bite the bullet and find the mistakes
1. The sentence between the two functions in util.php: if ($key != ' ' && $val != ' ') is missing the quotation marks
2. This comment on the main file: //Sandbox environment call address There is something wrong with the space in front of it, just delete it
. . . This official demo is too funny
It finally works, and a bunch of messy stuff is returned, which is completely different from what the API tool returns
http://my.open.taobao.com/apitools/apitools.htm