Jump to content

Amazon "Lite" Version - PHP not working (need help before Monday, please :))


Recommended Posts

So I have to finish a midterm assignment by tomorrow. I thought my PHP was correct, but apparently it's wrong. Here's the assignment:


Create a PHP script which will read in a variable keyword and, with the data contained in that variable, query Amazon for items related to that data, and return those items. This amounts to adding &Keywords= to your standard Amazon query string. Post it on your website as midterm.php


I've made the html and the xml file okay, but it's the php file that's giving me trouble. The point of the project is to create a search bar that will reference one of Amazon's items (like books, movies, etc.), then allow the user to type in whatever and search for it. My php file looks like this:




#! usr/local/bin/php





<title> midterm.php </title>







include "data.php";

include "language.php ";


$url =" http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1PRD4ZJ5Q38MD414GS02&Operation=ItemSearch&ResponseGroup=Medium,Request&SearchIndex=Books&BrowseNode=1000&Sort=salesrank&Style=http://www.pic.ucla.edu/~karenyee/homework2.xsl&Keywords= "

echo $_REQUEST['keyword'];

$query_string = '';



$params = array{

'mode'        => 'dvd',

'sort'        => '+salesrank',

'page'        => '1',

'type'        => 'lite',

'devtag'      => '11VJYHGRK99W0JW87Y02',



foreach ($params as $key => $value) {

    $query_string .= "$key=" . urlencode($value) . "&";



$website = "$url$query_string";


$xml = file_get_contents($website);


$result = $proxy->BrowseNodeSearchRequest














Does that look like it would work? What's wrong with it? You can check my site at http://www.pic.ucla.edu/~karenyee/ and click on midterm.html to see if it works (it should be working like www.pic.ucla.edu/~sndesai 's one, but it doesn't).


Thanks so much!!



Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.