万邦淘宝/天猫 API 按关键字搜索淘宝商品接口数据演示

onebound.taobao.item_search

没有key?申请开通万邦api key API 测试工具

URL:http://api.onebound.cn/taobao/api_call.php?api_name=item_search&q=%E5%A5%B3%E8%A3%85&start_price=0&end_price=0&page=1&cat=0&discount_only=&sort=&page_size=&seller_info=&nick=&ppath=&imgid=&filter=&key=test_api_key&secret=&guest_ip=3.230.119.106API返回字符串[JSON]API格式化数据API数据演示
Total:4400 Items
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • ...
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • ... 100
  • API数据演示(源码参考) <!--商品列表-->

    <div class="merchandise">
                    
    <div class="remen ">

    <?php 
        
    #如果$url使用默认,即空值,则赋值为本页URL
        
    $burl=$_SERVER["REQUEST_URI"];
        
    $sort = isset($_GET['sort'])?$_GET['sort']:''
        
    $q = isset($_GET['q'])?$_GET['q']:''
        
        
        
    $get=$_GET;
        unset(
    $get['sort']);
        
    $surl '?'.http_build_query($get).'&sort';
        
        
        
    $get=$_GET;
        unset(
    $get['q']);
        unset(
    $get['page']);
        
    $qurl '?'.http_build_query($get).'&q';
        
        
    ?>
    <div class="list_sort"><font>Sort:</font>
    <a class="select" href="<?php echo $url?>">Default</a> 
    <a href="<?php echo $surl?>=_sale">Sale <span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span></a>
    <a href="<?php echo $surl?>=_credit">Credit <span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span></a>
    <a href="<?php echo $surl?>=_bid2">Price <span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span></a>
    <a href="<?php echo $surl?>=bid2">Price <span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span></a> 

    Keyword:<input name="q" value="<?php echo $_GET['q']?>"  onKeyDown="if(event.keyCode==13) {window.location='<?php echo $qurl?>='+this.value; return false;}" >
    </div>                    
    <span>
    Total:<?=$api_data['items']['real_total_results']?> Items</span>

    </div>
                    
            <ul class="goods_list">

    <?php foreach($api_data['items']['item'] as $item){?>

              <li>
                <div class="pic"> <a target="_blank" href="?key=test_api_key&api_name=item_get&num_iid=<?php echo $item['num_iid'?>"> <img onerror="this.src='templates/unify/images/noimg220.gif';" alt="<?php echo $item['title'?>" src="<?php echo $item['pic_url'?>_220x220.jpg"></a> </div>
                <div class="summary">
                  <h1> <a title="" target="_blank" href="?key=test_api_key&api_name=item_get&num_iid=<?php echo $item['num_iid'?>"><?php echo $item['title'?></a></h1>
                  <p><?php echo $item['price'?></p>

                </div>
              </li>
              <?php }?>

      
            </ul>
                </div>
    <div class="yj">
    <?php

        $page
    =isset($_GET['page'])?$_GET['page']:1;
         if(
    $page<1)$page=1;
      
         
        
    #如果$url使用默认,即空值,则赋值为本页URL
        
    $url=$_SERVER["REQUEST_URI"];
         
        
    #URL分析
        
    $parse_url=parse_url($url);
        @
    $url_query=$parse_url["query"];    //取出在问号?之后内容
        
    if($url_query){
            
    $url_query=preg_replace("/(&?)(page=$page)/","",$url_query);
            
    $url str_replace($parse_url["query"],$url_query,$url);
            if(
    $url_query){
              
    $url .= "&page";
            }else 
    $url .= "page";
        }else 
    $url .= "?page";
        
        
        
        
    $max $api_data['items']['total_results'];
        
    $per = (int)$api_data['items']['page_size'];
        if(
    $per<=0)$per=40;
        
    $maxpage=ceil($max/$per);
            
            
            
    $s=0;
            
    $s2=0;
            
            
            
    ?>
      <div class="pages"><em></em>
      
      <?php for($p=1;$p<=$maxpage;$p++){
                if(
    $p>5&&$p<$maxpage-5&&abs($p-$page)>5){
                    if(
    $p-$page>0){
                        if(
    $s==0) echo '...';
                        
    $s=1;
                    }else{
                        if(
    $s2==0) echo '...';
                        
    $s2=1;
                    }
                    continue;
                }
                
    //echo '<li><a href="'.$url.'='.$p.'">'.$p.'</a></li>';    
                //
                
    if($p==$page){?>
                 <li class="current"><?php echo $p?></li>
                <?php 
                
    }else{
                
                
    ?>
                <li><a class=""  href="<?php echo $url?>=<?php echo $p?>"><?php echo $p?></a></li>
                <?php 
                
    }
            }
            
    ?>
      
      
      <li><a class="next"  href="<?php echo $url?>=<?php echo $page+1?>">Next</a></li>
     
      <li><a class="last" href="<?php echo $url?>=<?php echo $maxpage?>">... <?php echo $maxpage?></a></li>
      <i><input type="text" onKeyDown="if(event.keyCode==13) {window.location='<?php echo $url?>='+this.value; return false;}" size="3" name="custompage"></i></div>      </div>

    .