<address id="xdftd"><form id="xdftd"><meter id="xdftd"></meter></form></address>
              <form id="xdftd"><nobr id="xdftd"><nobr id="xdftd"></nobr></nobr></form>

                  <sub id="xdftd"></sub>

                        <address id="xdftd"><nobr id="xdftd"></nobr></address>

                          福州網站建設>網站新聞>php技術

                          通過淘寶ID獲取淘寶商品詳情

                          發布日期:2017-11-21瀏覽次數:1737 來源:福州網站建設

                          通過淘寶ID獲取淘寶商品詳情,親測可用哈??!
                          print_r(getInfo(556112013525));
                          function getInfo($iid)
                          {
                           
                          $murl = "http://hws.m.taobao.com/cache/wdetail/5.0/?id=" . $iid; 
                          $ch = curl_init();
                          curl_setopt($ch, CURLOPT_URL, $murl);
                          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
                          curl_setopt($ch, CURLOPT_MAXREDIRS, 2);
                          $file_contents = curl_exec($ch);
                          curl_close($ch);
                          if (!$file_contents) {
                          $file_contents = file_get_contents($murl);
                          }
                          $data = getTaobaoShopInfo($file_contents);
                          $data['num_iid'] = $param['id'];
                          return $data;
                           
                          }
                           
                          function getTaobaoShopInfo($content)
                          {
                          $data = json_decode($content, true);
                           
                          $info = array();
                          $tmp = json_decode($data['data']['apiStack'][0]['value'], true);
                          $info['title'] = $data['data']['itemInfoModel']['title'];
                          $info['volume'] = $tmp['data']['itemInfoModel']['totalSoldQuantity'];
                          $info['ems'] = $tmp['data']['delivery']['deliveryFees'][0];
                          $info['coupon_price'] = $tmp['data']['itemInfoModel']['priceUnits'][0]['price'];
                          if (substr_count($info['coupon_price'], '-')) {
                          $tmp1 = explode('-', $info['coupon_price']);
                          $info['coupon_price'] = min($tmp1[0], $tmp1[1]);
                          }
                          $info['price'] = $tmp['data']['itemInfoModel']['priceUnits'][1]['price'];
                          if (substr_count($info['price'], '-')) {
                          $tmp = explode("-", $info['price']);
                          $info['price'] = min($tmp[0], $tmp[1]);
                          }
                          $info['pic_url'] = $data['data']['itemInfoModel']['picsPath'][0];
                          $info['pics'] = $data['data']['itemInfoModel']['picsPath'];
                          $info['pic_url'] = str_replace("_320x320.jpg", "", $info['pic_url']);
                          $info['sellerId'] = $data['data']['seller']['userNumId'];
                          $info['nick'] = $data['data']['seller']['nick'];
                          $info['type'] = $data['data']['seller']['type'];
                          $info['cu'] = $tmp['data']['itemInfoModel']['priceUnits'][0]['name'];
                          if (!$info['cu']) {
                          $info['cu'] = $tmp['data']['itemInfoModel']['priceUnits'][0]['tips'][0]['txt'];
                          }
                          $info['feedback'] = $data['data']['rateInfo']['rateDetailList'][0]['feedback'];
                          $info['nicker'] = $data['data']['rateInfo']['rateDetailList'][0]['nick'];
                          $info['headPic'] = $data['data']['rateInfo']['rateDetailList'][0]['headPic'];
                          $info['feedback1'] = $data['data']['rateInfo']['rateDetailList'][1]['feedback'];
                          $info['nicker1'] = $data['data']['rateInfo']['rateDetailList'][1]['nick'];
                          $info['headPic1'] = $data['data']['rateInfo']['rateDetailList'][1]['headPic'];
                          $info['feedback2'] = $data['data']['rateInfo']['rateDetailList'][2]['feedback'];
                          $info['nicker2'] = $data['data']['rateInfo']['rateDetailList'][2]['nick'];
                          $info['headPic2'] = $data['data']['rateInfo']['rateDetailList'][2]['headPic'];
                          $info['feedback3'] = $data['data']['rateInfo']['rateDetailList'][3]['feedback'];
                          $info['nicker3'] = $data['data']['rateInfo']['rateDetailList'][3]['nick'];
                          $info['headPic3'] = $data['data']['rateInfo']['rateDetailList'][3]['headPic'];
                          $info['feedback4'] = $data['data']['rateInfo']['rateDetailList'][4]['feedback'];
                          $info['nicker4'] = $data['data']['rateInfo']['rateDetailList'][4]['nick'];
                          $info['headPic4'] = $data['data']['rateInfo']['rateDetailList'][4]['headPic'];
                          $info['descInfo'] = $data['data']['descInfo']['briefDescUrl'];
                                   
                          //$ftxia_https = new ftxia_https();
                          //$ftxia_https->fetch($info['descInfo']);
                          //$source = $ftxia_https->results;
                          //if (!$source) {
                          //$source = file_get_contents($info['descInfo']);
                          //}
                          //$comlist = json_decode($source, true);
                          //$tm = $comlist['data']['images'];
                          //$onepic = '<img class="lazy" src=' . $tm[0] . '>';
                          //$zcitem['desc'] = implode('', $tm);
                          // foreach ($tm as $sms) {
                          //if (strpos($zcitem['desc'], $sms)) {
                          //$imgurl = '<img class="lazy" src=' . $sms . '>';
                          //$zcitem['desc'] = str_replace($sms, $imgurl, $zcitem['desc']);
                          //$zcitem['desc'] = str_replace($tm[0], '', $zcitem['desc']);
                          //}
                          //}
                          $info['desc'] = $onepic . '' . $zcitem['desc'];
                          return $info;
                          }

                          以上是由福州網站建設的小編為你分享了"通過淘寶ID獲取淘寶商品詳情"文章,如果你在這方面有什么問題,隨時聯系我們

                          php技術有關的文章
                          如果您有什么問題,歡迎咨詢我們客服! 點擊QQ咨詢
                          双乳被三男吸的小说

                            <address id="xdftd"><form id="xdftd"><meter id="xdftd"></meter></form></address>
                                      <form id="xdftd"><nobr id="xdftd"><nobr id="xdftd"></nobr></nobr></form>

                                          <sub id="xdftd"></sub>

                                                <address id="xdftd"><nobr id="xdftd"></nobr></address>