Client wants to gather competitor prices and display them on webpage

ninjamudkipz

New Member
I have a client that wants to gather products from bestbuy, (they have an api ready), tiger direct, newegg, and amazon, and then display the prices in highest to lowest and then have a button that automatically updates to direct the customer to the site with the lowest price. They want everything in this process to be automated so they don't have to constantly update prices.

1.) How can i use php to collect the prices from each website?
2.) How can i make them show in highest to lowest order?
3.) How can i have the button update to the lowest priced site?

I shouldn't really ask why, because i only really need to know what to use and then i can research it and figure it out myself, just give me somewhere to start from!


-thanks
 

nafirici

New Member
the first thing you would want to do is to read there api rules. They may not allow competitor websites to use the api.

Then I would look at the documentation from the api's and capture there data and put it into a database on your client site and figure out a way to tie there products to your clients. Then it will be as simple as adding an order by for you query on the product page.
 

Sogo7

New Member
The specifics of how each API behaves does vary, so you will have to read all the relevent documentation for each one.

Generally it boils down to submitting a querystring and decoding the results using either the cURL commands in PHP (or file_get_contents) or even sometimes as a javascript source file as is the case with the Yahoo Pipes API to send the request. After that one typically enters the realms of decoding XML or JSON data strings

PHP contains a number of commands for sorting arrays of values and Php.net is a good place to find out more. Remember you are unlikely to be the first who needed a script to do this so do make sure to search Google.

Now the ugly bit..
When the seller does not have an API, you can fetch the information using the CURL or file_get_contents commands to copy the entire page to your server where it can processed and prices can be extracted using the regex commands in PHP. It's a process known as 'site scraping' and most web hosting providers do not like people doing it because of the load it places on the server.
 
Top