Skip to Main Content
Amazon Hacks
book

Amazon Hacks

by Paul Bausch
August 2003
Intermediate to advanced content levelIntermediate to advanced
304 pages
7h 33m
English
O'Reilly Media, Inc.
Content preview from Amazon Hacks

Embed Product Details into a Web Page with PHP

A simple way to display product data with existing PHP functions.

One great aspect of an open API is that other developers have probably already put together some tools to make your life easier. After all, why reinvent the wheel if someone else has already created what you need? These helper scripts are called wrappers because they wrap up some frequently used code into a few functions that you can call from another script. Daniel Filzhut, the author of the amazon_functions PHP wrapper, asks that people register if they earn quarterly associates fees greater than $50; but otherwise, it’s free to try out or use for commercial purposes.

What You Need

To get started with this hack, you’ll need to download the code from http://associatesshop.filzhut.de (choose “download” from the left-hand menu).

Unzip the package and open amazon_functions.php in the functions directory. Change the first line under Setup at the top of the file to include your developer’s token:

define ("DEVTOKEN", "insert  developer token");

The Code

The file with the helper functions is now ready to be included in any PHP script. This script has several functions that handle requesting information from Amazon and generating HTML based on the responses. Pick your favorite ASIN [Hack #1] and create a file called detail.php with the following code:

<?php

include('amazon_functions.php');

$Data=amazon_search_asin("0596004478","HEAVY"); $ProductInfoHTML=amazon_create_productinfo($Data); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

From ChatGPT to HackGPT: Meeting the Cybersecurity Threat of Generative AI

From ChatGPT to HackGPT: Meeting the Cybersecurity Threat of Generative AI

Karen Renaud, Merrill Warkentin, George Westerman
Incident Metrics in SRE

Incident Metrics in SRE

Stepan Davidovic

Publisher Resources

ISBN: 0596005423Supplemental ContentCatalog PageErrata