• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » Wordpress » Easy Get ASIN with My Amazon Asin Grabber Class

Easy Get ASIN with My Amazon Asin Grabber Class

By Sigit Prasetya Nugroho ∙ April 1, 2015 ∙ Wordpress ∙ 5 Comments

Share : TwitterFacebookTelegramWhatsapp

It’s been a long time not make an article about amazon affiliate site, I will share a script, how to grab ASIN code on amazon sites easily. With my script, you can easily get thousands of ASIN in minutes.

Easy Get ASIN with My Amazon Asin Grabber Class

Preparation
1. Download simple_html_dom class here as tool.
2. Copy asingrabber class below and save it as asingrabberclass.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/*
* Sigit Prasetya Nugroho https://seegatesite.com
*
* Amazon asin grabber class, how to grab amazon asin code with easy way.
*/
class asingrabber{
function get_content($url)
{
$content =  @file_get_contents($url);
if($content)
{
$hasil = $content;
}
else
{
$hasil ='false';
}
return $hasil;
}
function get_asin($content)
{
require_once('simple_html_dom.php');
$xml = new simple_html_dom();
$xml->load($content);
$asin='';
$hasil = @$xml->find('li[data-asin]');
$jum = count($hasil);
for ($i=0; $i < $jum ; $i++) {
$asin .= $hasil[$i]->getAttribute('data-asin').",";
}
return $asin;
}
}
?>

3. Create a php file to experiment using asingrabberclass to grab thousands of ASIN on the amazon site. Copy this script below

1
2
3
4
5
6
require_once('asingrabberclass.php');
$url='amazon site'; // example : http://www.amazon.com/s/ref=nb_sb_noss/189-8301552-0738035?url=search-alias%3Daps&field-keywords=iphone+6
$amazon = new asingrabber;
$content = $amazon->get_content($url);
$asinlist = $amazon->get_asin($content);
echo $asinlist;

It’s very easy to use. The example above is basic using asingrabberclass.php script. I will show a more complex example how to grab thousands ASIN use asingrabberclass.php. Copy the script below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<meta charset="utf-8">
<title>Grab ASIN from amazon</title>
</head>
 
<body>
<h2>Grab asin from amazon by <a href='https://seegatesite.com'>seegatesite.com</a></h2>
<form method="post" action="" >
<table style="border:0px">
<tr>
<td>Url</td>
<td> : <input type="text" name="url" placeholder="Example : http://www.amazon.com/s?keywords=iphone" size="100" /></td>
</tr>
<tr>
<td>Page</td>
<td> : <input type="text" size="3" name="page" value="10" /></td>
</tr>
<tr>
<td colspan="2">
 
<hr>
 
<input type="submit" name="submit" value="Grab Asin" id="submit"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit']))
{
echo "
 
<hr>
 
Result : </br>";
echo '
<div id="progress" style="width:500px;border:1px solid #ccc;"></div>
';
echo '
<div id="information" style="width"></div>
';
require_once('asingrabberclass.php');
$url=$_POST['url'];
$page=$_POST['page'];
$asinlist='';
for($i=1;$i<=$page;$i++)
{
$percent = intval($i/$page * 100)."%";
echo '<script language="javascript">
document.getElementById("progress").innerHTML="
<div style=\"width:'.$percent.';background-color:#ddd;\">&nbsp;</div>
";
document.getElementById("information").innerHTML="Page : '.$i.' processed.";
</script>';
$newurl=trim($url).'&p='.$i;
$amazon = new asingrabber;
$content = $amazon->get_content($newurl);
$asinlist .= $amazon->get_asin($content);
echo str_repeat(' ',1024*64);
flush();
sleep(0.005);
}
$count=count(explode(",",$asinlist));
echo "finish grab $count ASIN !
";
echo "<textarea rows='12' cols='50'>".$asinlist."</textarea>";
}
?>
</body>
</html>

Watch the following video snippets how to grab asin with asingrabberclass.php.

Next time i will share my amazon class script to get amazon product detail with API. 🙂

Another WordPress Related Post :

  • How To Create The Fastest Social Share Button WordPress Without Plugin
  • Create WordPress Slider Without Javascript
  • The Point Responsive WordPress Theme For Blogging
  • The Doctors Free WordPress Responsive Theme For Medical
  • Develop Your Site With Start Blogging The Responsive WordPress Theme
  • Zerius Theme The Free WordPress Responsive Theme

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Comments

  1. Avatar for JeffJeff says

    August 13, 2016 at 10:00 am

    Thank you so much for your helpful site. I tried your Amazon Asin Grabber, but unfortunately the tool does not seem to work properly. I tried to grab asins from amazon.com but somehow no data is being pulled in.

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      August 13, 2016 at 11:40 am

      okay thank you. Not all products ASIN permitted to be offered by Amazon. So not all products can be taken.but I’ll check back in my code 🙂 thanks

      Reply
  2. Avatar for JeffJeff says

    August 16, 2016 at 12:38 pm

    Thanks for fixing your grabber tool! What was the problem? Did amazon change the website structure?

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      August 16, 2016 at 3:10 pm

      No, you can use my amazon ASIN Code grabber more powerfully for WordPress plugin here https://seegatesite.com/free-amazon-asin-grabber-plugin-and-tutorial/

      Reply
  3. Avatar for IyanIyan says

    December 20, 2016 at 5:38 pm

    Terima kasih script grabbernya, tapi saya mau tanya mas.
    kenapa waktu saya jalankan diserver (pake share hosting) sering error “operation timed out” , kalau ga salah share hosting kan memberikan limit buat menjalankan script 30 detik kan.
    bagaimana cara mengatasinya mas?
    satu lagi pertanyaannya mas, bagaimana caranya kalau script ini digabung dengan Ajax seperti tools mas yang Amazon product scraper yang ini https://seegatesite.com/tools/amazon_scraper.php

    Terima kasih sebelumnya mas

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      December 23, 2016 at 6:01 am

      1.mengatasi timeout tambahkan kode berikut di header anda
      [php]
      ini_set(‘max_execution_time’, 7000);// silahkan sesuaikan dengan waktu yang diinginkan
      [/php]
      2. Silahkan kirim parameter yang dibutuhkan melalui ajax..dan tampilkan result valuenya..

      [php]
      var value = {
      param1: var_param1,
      param2: var_param2,
      …..
      };
      $.ajax(
      {
      url : "xxxxxx.php", // url server amazon script anda
      type: "POST",
      data : value,
      success: function(data, textStatus, jqXHR)
      {
      var data = jQuery.parseJSON(data);
      //tampilkan hasilnya
      },
      error: function(jqXHR, textStatus, errorThrown)
      {

      }
      });
      [/php]

      semoga membantu

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

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

Primary Sidebar

Welcome to my Home,

Avatar for Sigit Prasetya NugrohoThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (7) Publisher Tips (5) react (3) Reactjs (7) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) widget (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2021 Seegatesite.com