private function get_taobao_goods_info_by_url($url) { require BASE_DATA_PATH . DS . 'api' . DS . 'taobao' . DS . 'index.php'; $taobao_api = new taobao_item(); $taobao_goods_info = $taobao_api->fetch($url); $result = FALSE; if ($taobao_goods_info) { //处理图片地址 $item_img = (array) $taobao_goods_info['item_imgs']; $item_img = (array) $item_img['item_img'][0]; $item_img = $item_img['url']; $url_array = explode('.', $item_img); $ext = end($url_array); $item_img = $item_img . '_160x160.' . $ext; $result = array(); $result['result'] = 'true'; $result['id'] = 0; $result['url'] = $taobao_goods_info['detail_url']; $result['price'] = $taobao_goods_info['price']; $result['storeid'] = 0; $result['title'] = $taobao_goods_info['title']; $result['img'] = $item_img; $result['image'] = $item_img; $result['type'] = 'taobao'; } return $result; }
private function get_taobao_goods_info_by_link($link) { require BasePath . DS . "api" . DS . "taobao" . DS . "index.php"; $taobao_api = new taobao_item(); $taobao_goods_info = $taobao_api->fetch($link); $result = FALSE; if ($taobao_goods_info) { $item_img = (array) $taobao_goods_info['item_imgs']; $item_img = (array) $item_img['item_img'][0]; $item_img = $item_img['url']; $url_array = explode(".", $item_img); $ext = end(&$url_array); $item_img = $item_img . "_40x40." . $ext; $result = array(); $result['result'] = "true"; $result['url'] = $taobao_goods_info['detail_url']; $result['price'] = $taobao_goods_info['price']; $result['title'] = $taobao_goods_info['title']; $result['image'] = $item_img; } return $result; }
/** * Get taobao product information * * @param string $link */ private function getTaobaoGoodsInfo($link) { require BASE_DATA_PATH . DS . 'api' . DS . 'taobao' . DS . 'index.php'; $taobao_api = new taobao_item(); $taobao_goods_info = $taobao_api->fetch($link); if (!$taobao_goods_info) { return false; } $item_img = (array) $taobao_goods_info['item_imgs']; $item_img = (array) $item_img['item_img'][0]; $item_img = $item_img['url']; $url_array = explode('.', $item_img); $ext = end($url_array); $item_img = $item_img . '_40x40.' . $ext; $return = array(); $return['id'] = 0; $return['name'] = $taobao_goods_info['title']; $return['price'] = $taobao_goods_info['price']; $return['storeid'] = 0; $return['img'] = $item_img; $return['image'] = $item_img; $return['uri'] = $link; $return['type'] = 1; return $return; }