Onebound API SDK调用示例(TAOBAO)[调用所有平台API示例][下载]


//定义缓存目录和引入文件
define('DIR_RUNTIME','runtime/');
define('DIR_ERROR','runtime/');
define('SECACHE_SIZE','0');

include ("ObApiClient.php");

$obapi = new otao\ObApiClient();
$obapi->api_url = 'http://api.onebound.cn/';
$obapi->api_urls = array('http://api.onebound.cn/','http://api-1.onebound.cn/');//备用API服务器
$obapi->api_urls_on = true;//当网络错误时,是否启用备用API服务器
$obapi->api_key = 'demo_api_key';
$obapi->api_secret = '';
$obapi->api_version ='';
$obapi->secache_path ='runtime/';
$obapi->secache_time ='86400';
$obapi->cache = true;

    
示例:获取分类ID=16的商品列表 item_search:

用时:0.07363秒

Error:string(48) "Key[demo_api_key]已欠费,联系QQ:583964941。"

获取分类代码如下:
 


//示例:获取分类ID=16的商品列表
$api_data = $obapi->exec(array(
    'api_type' => 'taobao', 
    'api_name' => 'item_search', 
    'api_params' => array(
        'q' => '', 
        'page' => 1, 
        'cat' => 16,
        'sort' => '', 
        'page_size' => '', 
        'ppath' => '', 
        'imgid' => ''
        )));
$items=$api_data['items'];

print_r($items);
  

示例:获取产品ID=39881745164的商品详细 item_get:

用时:0.05773秒

Error:string(48) "Key[demo_api_key]已欠费,联系QQ:583964941。"

获取产品代码如下:
 
$api_data = $obapi->exec(
                array(
                'api_type' =>'taobao',
                'api_name' =>'item_get',
                'api_params'=>array('num_iid'=>557216270522)
                )
            );
$item = $api_data['item'];


 print_r($item);
 

Powered by:万邦 www.onebound.cn All Rights Reserved. QQ:583964941