Home  >  Article  >  Backend Development  >  Share Taobao API auxiliary function-applicable CI framework_PHP tutorial

Share Taobao API auxiliary function-applicable CI framework_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:12:221061browse

This article introduces and shares the Taobao API auxiliary function-applicable CI framework to all students. Friends who need to know more can refer to it.

Recently I am rewriting a Taobao website. Considering the future scalability, I integrated it into CI. This raises a question. How to integrate Taobao’s SDK into the class library? After carefully reading the Taobao API documentation, I found a non-SDK calling method. Based on this, I modified it and integrated it into a CI helper function. Now I share the source code with everyone, hoping to help students in need.

Calling the method is very simple. Pass in an array parameter, where method is the API interface you plan to call, and the remaining parameters are filled in according to the actual needs of the API interface. Let me give you a calling example here.

The code is as follows
 代码如下 复制代码


  
$paramArr = array(   
    ’method’    => ’taobao.taobaoke.items.get’,  //API名称   
    ’fields’    =>’num_iid,title,nick,pic_url,price,click_url,seller_credit_score,   
commission,commission_rate,volume’,   
    ’pid’       =>YOUR PID,   
    ’page_size’ =>YOUR PAGE_SIZE,   
    ’sort’      =>YOUR SORT,   
    ’keyword’   =>your keyword,   
);   
$this->load->helper(‘taoapi’);   
$result['item_list'] = send($paramArr);  

Copy code

  
$paramArr = array(  
 'method' => 'taobao.taobaoke.items.get', //API name
'fields' =>'num_iid,title,nick,pic_url,price,click_url,seller_credit_score,
commission,commission_rate,volume',
'pid' =>YOUR PID, 'page_size' =>YOUR PAGE_SIZE,
'sort' =>YOUR SORT,
'keyword' =>your keyword,
);
$this ->load->helper('taoapi');
$result['item_list'] = send($paramArr);

http://www.bkjia.com/PHPjc/444590.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/444590.html
TechArticle
This article introduces and shares Taobao API auxiliary functions-applicable CI framework, friends who need to know more can refer to it. Recently, I am rewriting a Taobao website. Considering the future scalability, so...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn