Php 使用易趣API时在多个页面中显示结果

Php 使用易趣API时在多个页面中显示结果,php,ebay-api,Php,Ebay Api,即使使用了paginationInput.pageNumber=3”,结果集也只显示一个页面 如何在多个页面中显示结果,并在底部显示页面链接 $apicall .= "&paginationInput.entriesPerPage=12"; $apicall .= "&paginationInput.pageNumber=3";" 上面的字段是在eBay developers desk中指定的,他们也在使用xml,但我没有使用以下代码获得结果: <?php

即使使用了
paginationInput.pageNumber=3”
,结果集也只显示一个页面

如何在多个页面中显示结果,并在底部显示页面链接

    $apicall .= "&paginationInput.entriesPerPage=12";
    $apicall .= "&paginationInput.pageNumber=3";"
上面的字段是在eBay developers desk中指定的,他们也在使用xml,但我没有使用以下代码获得结果:

<?php
    $endpoint  = 'http://svcs.ebay.com/services/search/FindingService/v1'; // URL to call
    $version   = '1.11.0'; // API version supported by your application
    $appid     = 'myid'; // Replace with your own AppID
    $globalid  = 'EBAY-AU'; // Global ID of the eBay site you want to search (e.g., EBAY-DE)
    $query     = 'smartphones'; // You may want to supply your own query
    $safequery = urlencode($query); // Make the query URL-friendly

    // Construct the findItemsByKeywords HTTP GET call
    $apicall = "$endpoint?";
    $apicall .= "OPERATION-NAME=findItemsAdvanced";
    $apicall .= "&SERVICE-VERSION=$version";
    $apicall .= "&SECURITY-APPNAME=$appid";
    $apicall .= "&GLOBAL-ID=$globalid";
    $apicall .= "&keywords=$safequery";
    $apicall .= "&paginationInput.entriesPerPage=12";
    $apicall .= "&paginationInput.pageNumber=3";


    $knt=0;

    // Load the call and capture the document returned by eBay API
    $resp = simplexml_load_file($apicall);

    // Check to see if the request was successful, else print an error
    if ($resp->ack == "Success") {
        $results = '';
        // If the response was loaded, parse it and build links
        foreach ($resp->searchResult->item as $item) {
            $pic   = $item->galleryURL;
            $link  = $item->viewItemURL;
            $title = $item->title;
            $price = $item->sellingStatus->currentPrice;

            // For each SearchResultItem node, build a link and append it to $results
            $results .= "<div id='prod-wrap'><div class='prodimg-wrap' align='center'><img src=\"$pic\" class='prodimg'></div> <div class='prodtxt' align='center'><a href=\"$link\">$title</a></div><div class='price' align='center'><p class='price' align='center'>$price</p></div></div>";
            $knt++;
        }
    }
    // If the response does not indicate 'Success,' print an error
    else {
        $results = "<h3>Oops! The request was not successful. Make sure you are using a valid ";
        $results .= "AppID for the Production environment.</h3>";
    }
    ?>
    <!-- Build the HTML page with values from the call response -->
    <html>
    <head>
        <style type="text/css">
            body {
                font-family: arial, sans-serif;
            }

            img {
                border: none;
            }

            #store-wrap {
                width:    770px;
                height:   auto;
                position: relative;
            }

            #filter-wrap {
                width:            160px;
                float:            left;
                height:           500px;
                margin-right:     10px;
                background-color: #EBEBEB;
            }

            #result-wrap {
                width:    600px;
                float:    left;
                height:   auto;
                position: relative;
            }

            #pagination-wrap {
                width:  200px;
                float:  right;
                height: 20px;
            }

            #prod-wrap {
                width:            150px;
                height:           200px;
                margin:           0 15px 15px;
                float:            left;
                border:           1px solid #999999;
                background-color: #CCCCCC;
            }

            .prodimg-wrap {
                width: 150px;
            }

            .prodimg {
                width:   100px;
                height:  100px;
                padding: 4px;
            }

            .prodtxt {
                font-size: 11px;
                width:     130px;
                padding:   0 8px;
            }
            .price {
                font-size: 11px;
                width: 60px;
                padding: 0 8px;
            }
            .price p {
                font-size: 11px;
                color: black;
            }
        </style>
    </head>
    <body>

    <h1><?php echo $query; ?></h1>

    <table>
        <tr>
            <td>
                <div id="store-wrap">

                    <div id="result-wrap">
                        <?php echo $results;?>

                    </div>
                </div>
            </td>
        </tr>
    </table>
     <?php echo $knt;?>


    </body>
    </html>
ack==“成功”){
$results='';
//如果已加载响应,则解析它并构建链接
foreach($resp->searchResult->item as$item){
$pic=$item->galleryURL;
$link=$item->viewItemURL;
$title=$item->title;
$price=$item->sellingStatus->currentPrice;
//对于每个SearchResultItem节点,构建一个链接并将其附加到$results
$results.=“

$price

”; $knt++; } } //如果响应未指示“成功”,则打印错误 否则{ $results=“Oops!请求未成功。请确保使用的是有效的”; $results.=“生产环境的AppID。”; } ?> 身体{ 字体系列:arial,无衬线; } img{ 边界:无; } #保鲜膜{ 宽度:770px; 高度:自动; 位置:相对位置; } #过滤膜{ 宽度:160px; 浮动:左; 高度:500px; 右边距:10px; 背景色:#ebebebeb; } #结果包装{ 宽度:600px; 浮动:左; 高度:自动; 位置:相对位置; } #分页包装{ 宽度:200px; 浮动:对; 高度:20px; } #产品包装{ 宽度:150px; 高度:200px; 利润率:0 15px 15px; 浮动:左; 边框:1px实心#999999; 背景色:#中交; } .生产包装{ 宽度:150px; } 普罗迪姆先生{ 宽度:100px; 高度:100px; 填充:4px; } .prodtxt{ 字体大小:11px; 宽度:130px; 填充:0 8px; } .价格{ 字体大小:11px; 宽度:60px; 填充:0 8px; } .价格p{ 字体大小:11px; 颜色:黑色; }
您一次只能从易趣的API中检索1页数据/项目。指定第3页将只检索第3页,而不是第1-2页。如果您想要全部3页,则需要进行3次连续API调用,并在本地缓存数据,然后将其以HTML格式显示给最终用户