2

How can i fetch the price from Amazon?

If this is the product: http://www.amazon.co.uk/gp/product/B003BVI494/

I want the script to return the price 331.97

How can i do this with PHP? I signed up for Amazon API, do i have to use that?

EDIT: I have no idea how to use thei API, so if someone knows. Please help me!

Nicole
  • 43
  • 1
  • 4
  • 4
    You _should_ probably (and legally) use the API. – hometoast Jan 04 '11 at 01:03
  • Added to the post that i don't know how to use thei API and cannot find any samples that work either. – Nicole Jan 04 '11 at 01:05
  • You'd need to look up some tutorials about the API in that case. http://www.codediesel.com/php/accessing-amazon-product-advertising-api-in-php/ – Duniyadnd Jan 04 '11 at 01:34
  • Hi, Welcome to Stackoverflow. Since you're new here - perhaps the [FAQ](http://stackoverflow.com/faq) would help. –  Jan 04 '11 at 01:35
  • What API samples have you tried, why didn't they work, what error messages did you receive? –  Jan 04 '11 at 01:36
  • 1
    This is SO - we will help YOU find the solution, we will not find it for you. Refer to @brool's Answer, which points you towards the API material provided by Amazon, and should easily allow you to perform your required actions. Give it a go, if you get errors, then you are welcome to come back, show us what code you are using, and what errors you are getting, and, again, we will try and point you in the right direction to find a solution for yourself. – Luke Stevenson Jan 04 '11 at 02:31

4 Answers4

2

The Product Advertising API is the one that you want; they have a simple PHP library and example here. There is also a REST interface but you'll need to sign your requests.

brool
  • 2,093
  • 19
  • 8
1

Zinc has what you're looking for (and you can also get shipping and tax info if you have the end-user address). Check out the docs.

munchybunch
  • 5,863
  • 10
  • 46
  • 62
0

You can try taking a look at this related question.

Amazon Book API for Python or Ruby?

If you do not want to be limited to using python/ruby the general api documentation can be found here (http://docs.amazonwebservices.com/AWSECommerceService/2010-10-01/GSG/)

Furthermore if all you want is the price (and you happen to be running linux)

You can do -

wget http://www.amazon.co.uk/gp/product/B003BVI494/

grep 'priceLarge' B003BVI494

This will get you the html line the price is on :) (although you really shouldn't parse html with a regular expression even a simple one)

Community
  • 1
  • 1
diedthreetimes
  • 4,040
  • 25
  • 37
0

Yes, you can do this with PHP.

Use DomDocument and DomXPath to do this.

See example from:

http://php.net/manual/en/class.domdocument.php

http://php.net/manual/en/class.domxpath.php

  • This answer is not very useful: the answers are better self-contained: if the link is removed then this answer would be completely useless. – Javi Nov 24 '17 at 10:56