Popular talk is the integration and use of JSSDK.
JSSDK's official explanation:
Taobao JSSDK is based on JavaScript SDK, the site by introducing a JS file can be achieved:
Use JavaScript to access Taobao APIs securely and conveniently via JSSDK.
Through the JSSDK provides the component method, the quick, the simple integration Taobao electric quotient component.
The only access to higher-security services, such as the association recommendation for user Behavior in association recommendations, the Favorites interface, and so on.
Cooperative website does not need a strong back-end service system, through the front-end to obtain data and direct display, can get "small input to support a large number of users" effect.
Provide multi-dimensional user data Analysis service for the cooperative website.
The JSSDK Integration of PHP pages
Using a PHP program such as WordPress, the owner of the site is still very helpful this time,
Because the official document is the use of PHP document integration Jssdk to illustrate.
1. Load the Jssdk file in the page
One of the appkey=xxxxxxx behind the xxxxx is your Appkey
The code is as follows |
Copy Code |
<script src= "Http://l.tbcdn.cn/apps/top/x/sdk.js?appkey=xxxxxxx" ></script> |
2. Generate signature, deposit in cookie
The code is as follows |
Copy Code |
<?php $app _key = ' xxxxxxx ';/* Fill in Appkey * * $secret = '/* Fill in appsecret ' * * $timestamp =time (). " 000 "; string concatenation required for signature $message = $secret. ' App_key '. $app _key. ' Timestamp '. $timestamp. $secret; Get signature $mysign =strtoupper (Hash_hmac ("MD5", $message, $secret)); Deposit time Stamp Setcookie ("timestamp", $timestamp); Deposit Signature Setcookie ("sign", $mysign); ?> |
Taobao Guest Interface Calls
Here's an example of the simplest, official call interface
code is as follows |
copy code |
Top.api (' rest ' , ' get ', { method: ' Taobao.taobaoke.widget.items.convert ', track_iids: ' 19237740785_track_11116 ', fields: ' Num_iid,click_url,commission_rate ' },function (resp) { if (resp.error_response) { alert (' Taobao.taobaoke.widget.items.convert interface to get quotient information product failed! ' +RESP.ERROR_RESPONSE.MSG); return false; } var Respitem=resp.taobaoke_items.taobaoke_item; for (var i=0;i<respitem.length;i++) { //$ ("#r" + RESPITEM[I].NUM_IID). HTML ("commission:" +number (respitem[i].commission_rate)/100+ "%"); //$ ("#a" +respitem[i].num_iid). attr ("href", respitem[i].click_url); } }) |