The goal of this project is to learn server-side web programming using PHP. More specifically, you will develop an e-commerce web application where customers can buy products listed by the eBay Commerce Network API for Shopping.
This project must be done individually. No copying is permitted. Note: We will use a system for detecting software plagiarism, called Moss, which is an automatic system for determining the similarity of programs. That is, your program will be compared with the programs of the other students in class as well as with the programs submitted in previous years.
Note that, if you use a Search Engine to find similar programs on the web, we will find these programs too. So don't do it because you will get caught and you will get an F in the course (this is cheating). Don't look for code to use for your project on the web or from other students (current or past). Just do your project alone using the help given in this project description and from your instructor and GTA only. Finally, you should not post your code nor deploy your project on a public web site.
As in Projects #3 and #4, you will develop this project on your PC/laptop using XAMPP
and you will test it using using your Mozilla Firefox web browser.
Download the project3 files project3.zip.
Unarchive the files inside your web server document root directory.
The project3 directory contains the file buy.php, which needs to be changed
as described in the description of the web application.
You can test your setup on your web browser by using the URL address
The following are tutorials on PHP. Use them as a reference only.
$xmlstr = file_get_contents('someURL.com'); $xml = new SimpleXMLElement($xmlstr); foreach ($xml->BookList->BookData as $b) foreach ($b->Prices->Price as $p) if ($p['store_id'] == "amazon") print $b['isbn'] . ' ' . $b->Title . ' ' . $p['price'] . "\n";
You will develop a trivial web application that allows customers to buy products. You need to reverse-engineer my PHP script:
https://lambda.uta.edu/cgi-bin/php/buy.phpby filling out its forms and by looking at the HTML source that is generated by this script. Your task is to modify your own buy.php script in your project3 directory to make it behave like my buy.php, although you should make your script generate better HTML code to look nicer.
You will use the shopping.com API for shopping. The eBay Commerce Network API ("ECN API") is a flexible way to access and recreate practically everything you see on Shopping.com. You do not need to get an API key. You may use my API key in the given buy.php or you can use a demo API key. You will use the Search by keyword method and the Requesting category tree information -> Include all descendants in category tree method from the eBay Commerce Network Publisher API Use Cases.
Your search form must have a menu to select a category, a text window to specify search keywords, and a submit button. The menu must contain all sub-categories of the category "computers" (whose id is 72). The menu items should not be handwritten in the code; instead, they must be generated in your PHP code by requesting all the descendants of the category tree with id=72 (the computers category). The result of a keyword search must contain up to 20 products within the selected category that best match the keyword query. Each product contains a link productOffersURL to the shopping.com web page that gives a detailed description of the product and a list of best offers from various sellers. So each product has a range minPrice - maxPrice of the prices offered by these sellers. We will ignore the list of offers and we will assume that when we buy this product we pay the minPrice.
You need to use a PHP session to store the shopping basket (the list of chosen items throughout the session) as well as the results of the previous search. For each chosen item, you store the Id, the name, the minPrice, the first image, and the productOffersURL (the link to the shopping.com web page that lists the best offers for this item). Your PHP script must be able to handle the following query strings:
buy.php?category=9007&search=samsung+i7This should call the web service request http://sandbox.api.ebaycommercenetwork.com/publisher/3.0/rest/GeneralSearch?apiKey=xxx&trackingId=yyy&categoryId=9007&keyword=samsung+i7&numItems=20, where xxx and yyy are your access apiKey and your trackingId. The web service results will arrive in XML. To see how the XML data look like, cut and paste this URL on your browser and look at the reply.
buy.php?buy=138681275Your script should look at the results of the last search stored in $_SESSION to find the item under this Id and should copy it into the shopping basket.
Hints: you may use the PHP function print_r for debugging. It prints human-readable information about a variable.
Zip your project3 directory and use the form below to submit your project3.zip file. We do not accept email or hardcopy submissions. You may submit your files as many times as you like, but only the most recently submitted files will be retained and evaluated (newly submitted files replace the old files under the same file name). After you submit the files, please double-check that your submitted files are correct by clicking on the Status link.Last modified: 02/25/2016 by Leonidas Fegaras