dongqin1819 2012-05-27 01:14
浏览 38
已采纳

使用zend_service_amazon,但没有看到任何输出

I'm playing around with the Amazon developer's API and I'm not getting anything.

Here is my code. I am using echo to see if anything is happening and all I am getting is a blank webpage. I expected the array of search results to be echoed.

<?php
error_reporting(E_ALL); 
ini_set("display_errors", 1); 
require_once('Zend/Service/Amazon.php');

$amazon = new Zend_Service_Amazon('AKIAJQBYUXIFWUIX6W6A', 'US', 'YGV9zePfKejV6C3dpaP/NtnhjGLfWQsccdGSSL50');
$results = $amazon->itemSearch(array('SearchIndex' => 'Books',
                                     'Keywords' => 'php'));
foreach ($results as $result) {
    echo $result->Title . '<br />';
}

    ?>

getting a blank page still

  • 写回答

2条回答 默认 最新

  • douqulv6059 2012-05-27 07:04
    关注

    Your page is blank because you are no getting any results:

    This is the $results dump using your published code:

    Amazon object(Zend_Service_Amazon_ResultSet)#103 (4) {
      ["_results":protected] => object(DOMNodeList)#105 (0) {
      }
      ["_dom":protected] => object(DOMDocument)#101 (0) {
      }
      ["_xpath":protected] => object(DOMXPath)#104 (0) {
      }
      ["_currentIndex":protected] => int(0)
    }
    

    There are several issues to resolve to make this work, the biggest one being this:

    The following changes will take effect on 11/1/2011:
    Associate Tag Parameter: Every request made to the API should include a valid Associate Tag. Any request that does not contain a valid Associate Tag will be rejected with an appropriate error message. For details on the Associate Tag parameter, please refer to our Developer guide.

    Currently the constructor for Zend_Service_Amazon does not include the Associate Tag parameter and the _prepareOptions() method does not set the option.

    I'm sure someone has a fix for this, otherwise it's time to dig in and extend... Good Luck

    Amazon Product Advertising API
    Changes to Product Advertising API

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿