Quickly Build Amazon ASIN Grabber with Simple Html DOM

In my last article Easy Build Amazon ASIN Grabber with PHP and Curl, now i will share about how to use Simple HTML DOM to grab asin from amazon site. Basically, the concept is same, grab HTMLs element, but with Simple HTML DOM function , the script will be more simpler. Visit PHP Simple HTML DOM if you want to learn more about simple html DOM.

What is PHP Simple HTML DOM Parser ? From the site, The description, requirement & features is

  • A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way!
  • Require PHP 5+.
  • Supports invalid HTML.
  • Find tags on an HTML page with selectors just like jQuery.
  • Extract contents from HTML in a single line.

Okay lets start the experiment.

  • Download Simple Html DOM function here
  • Create php file with name asin_dom.php

 How Amazon ASIN Grabber with Simple Html DOM work ? 

  • You must include simple_html_dom.php on the first.

  • Scrap HTML element with

  • Next, you must examine the pattern of ASIN code layout on the amazon html element. in example,

We will grab iphone product in amazon. We get url ” http://www.amazon.com/s/ref=nb_sb_noss_2/176-0876229-3718769?url=search-alias%3Daps&field-keywords=iphone ” open with your browser , ( in this case i use chrome browser ). And then right click and choose view page source . Examine the line of code until you find the same pattern and sequence as follows

Find a href element contains <span class=”lrg bold”> , with that code  we will get url and the title. Use this script to grab that patern.

Congratulation, you create your amazon asin grabber with simple html dom.

You can develop the script to scrap the Amazon product description, price, etc. Contact us is you need to learn more.

This script is not function again, for new release of this script, please visit https://seegatesite.com/easy-get-asin-with-my-amazon-asin-grabber-class/

Click Here to try Amazon ASIN Grabber with Simple Html DOM.

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.


 Add your comment
  1. Dear Admin,
    In source code from url : hxxp://www.amazon.com/s/ref=nb_sb_noss_2/176-0876229-3718769?url=search-alias%3Daps&field-keywords=iphone ”.

    I’n not find a href element contains , help me please


  2. Can We Get The Variation Of A Parent ASIN Using PHP.??

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.