How to make my bot click on Amazon add to cart button?

I have a freelance assignment, the customer asked me to build a PHP bot that accepts one query parameter which is the name of the product and then search amazon.com to check if this product exists or not id did that step already.

2- The second step is to make the bot click on (Add to Cart button). I don’t know why he needs that and how I can do it can any one help?

My Question: Is there any way to be able to click add to cart button without opening the page? and It is a legal mission ?

Is there an Amazon API that would do that for you? This was the first result when I searched “Amazon Cart API”, does it help? Add to Cart form · Product Advertising API 5.0 (amazon.com) but I didn’t delve into it any further. An API would seem to be the preferred way if there is one.

You could always view the page source and try to see what the Amazon button actually does, but the down side of that approach is that you leave yourself open to needing to change your code whenever Amazon (or whoever) change theirs, and you won’t get any warning about that.

1 Like

If all the client wants is for the system to, add the product to the cart it sounds like they want to manipulate some statistics.

This is not allowed according to Amazon’s terms of service. In addition, it would not be very ethical to make this functionality knowing what it would be used for.

Anyway, the moral dilemma is yours, but what you looking for in this case is Selenium.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.