Jump to content

Kokichi

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Kokichi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 <html> <head> <title> midterm.php </title> </head> <body> <?php 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 ($params); print_r($result); ?> </body> </html> 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!! ~Karen
×
×
  • 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.