首先,在类目属性API下面我找到一个接口:taobao.itemcats.get标签:function,open,Taoapi,API,淘宝,Config,public From: https://blog.51cto.com/u_5112239/5948311
public function getAll()
//初始化淘宝API,将一些配置参数引入进来
$Taoapi_Config = Taoapi_Config::Init();
//实例化淘宝API
$Taoapi = new Taoapi;
//获取酒店cid
$Taoapi->method = 'taobao.itemcats.get';
$Taoapi->datetime = '2005-01-01 00:00:00';
我们发现酒店的cid就是50016161
public function getpid()
//初始化淘宝API,将一些配置参数引入进来
$Taoapi_Config = Taoapi_Config::Init();
//实例化淘宝API
$Taoapi = new Taoapi;
//获取酒店cid
$Taoapi->method = 'taobao.itemprops.get';
最后我们根据这些基本信息取回所有的酒店信息:
public function SearchHotels($city, $keyword, $page_size=5, $page_no=1, $order_by='volume', $price = 0, $star = 0)
$Taoapi_Config = Taoapi_Config::Init();
//实例化淘宝API
$Taoapi = new Taoapi;
//获取商品属性值 Get property values
$pvs = $this->GetPvs($Taoapi);
//$Taoapi->fields = 'detail_url,num_iid,title,nick,type,cid,seller_cids,props,input_pids,input_str,desc,pic_url,num,valid_thru,list_time,delist_time,stuff_status,location,price,post_fee,express_fee,ems_fee,has_discount,freight_payer,has_invoice,has_warranty,has_showcase,modified,increment,approve_status,postage_id,product_id,auction_point,property_alias,item_img,prop_img,sku,video,outer_id,is_virtual';
$Taoapi->fields = 'iid,num_iid,title,nick,pic_url,price,props_name,item_img,volume,score,detail_url';
//这个是我们调用的获取pid,vid,name,name_alias的函数,可以帮我们找到具体的省市的酒店
public function GetPvs($Taoapi)