下载 > 资源分类 >  开发技术 >  Web开发 > Amazon

Amazon

2004-08-03 上传大小:4KB
Now everybody heard of Amazon.com. What not everybody knows that Amazon released an API to access its huge catalogs. What this basically means is that each developer can access the information from Am
azon following some simple protocols and every site owner can enhance his own website with content and features from Amazon. 

The Amazon API comes as a simple Webservice. Here are the first Web services that they have exposed: 
- Product Display : The ability to search for and retrieve product information from the Amazon.com catalog. 
- Shopping Cart : The ability to add Amazon.com products to shopping carts, wish lists, and registries from third party locations. 

No matter of your intentions, you will first need to register and obtain a valid developer token. You can get your token here at this address: http://www.amazon.com/webservices 

The current listed implementation of Amazon webservices uses Keyword searches. It has basically the same results as searching the books catalog online. As any developer/webmaster can see in the "Amazon.com Web Services Developers Kit v 1.0" document, a lot of other Amazon features are exposed. This would imply extending the base structure I present here. 

There are multiple approaches from a developer's point of view. The simplest one deals with SOAP and web services classes already implemented in PHP. You could also extend the PEAR's XMLParser object to parse Amazon results. The reason I did not choose these directions is because they require additional extensions installed with PHP. What I currently use is the XML parsing package that comes embedded in PHP, so it is slightly more general. 

What basically happens in this implementation is that the search word entered by the used is embedded into a XML url that is then retrieved from Amazon.com. Then PHP builds a nice display for the information received. 

I should let the code talk for itself. Here is the main controller, with a small search form for Amazon: 

http://www.php9.com/php/source/amazon.phps 

As you see, the actual code is very small. Then here is the class used in the controller to parse the XML returned by Amazon. 

http://www.php9.com/php/source/amazon_class.phps 

Then the configuration file. I need to remember you that you need to change the DEVELOPER_TOKEN constant with the one you will obtain from Amazon. The current license key belongs to me. 

http://www.php9.com/php/source/amazon_config.phps 

And here is the layout template used to build the output from the XML document retrieved from Amazon. It is parsed every time a book record is retrieved, so the output rendering is the fastest possible. 

http://www.php9.com/php/source/amazon_layout.phps 

Here you have the full package zipped. 

http://www.php9.com/php/source/amazon.zip 

And of course a demo: http://www.php9.com/amazon.php 

Feel free to use it and improve. I am open to suggestions
...展开收缩
综合评分:4.1(24位用户评分)
直接下载 开通VIP会员 免积分下载

评论共有1条

name
wutangen2015-05-05 09:46:05
资源不错,就是看不懂

评论资源

您不能发表评论,可能是以下原因:

登录后才能评论

待评论资源
 

热门专辑

关闭
img

spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip

CSDN VIP年卡 4000万程序员的必选现在开通,立省522元
下载
img

Amazon

会员到期时间: 剩余下载个数: 剩余C币:0 剩余积分:
VIP下载

积分不足!

资源所需积分 当前拥有积分
您可以选择
开通VIP年卡
4000万
程序员的必选
600万
绿色安全资源
现在开通
立省522元
或者
购买C币兑换积分 C币抽奖
img
资源所需积分 当前拥有积分 当前拥有C币
5 4 45
(仅够下载10个资源)
VIP年卡
全站1200个资源免积分下载
下载
img
资源所需积分 当前拥有积分 当前拥有C币
5 0 0
VIP年卡
全站1200个资源免积分下载
C币充值开通VIP年卡
img
资源所需积分 当前拥有积分 当前拥有C币
5 4 45
您的积分不足,将扣除 10 C币
VIP年卡
全站1200个资源免积分下载
下载
下载

兑换成功

你当前的下载分为234开始下载资源
你还不是VIP会员
开通VIP会员权限,免积分下载
立即开通

你下载资源过于频繁,请输入验证码

你下载资源过于频繁,请输入验证码

您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:webmaster@csdn.net!

举报

若举报审核通过,可奖励20下载分

  • 举报人:
  • 被举报人:
  • 举报的资源分:
  • *类型:
  • *详细原因: