• 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
🏠 » PHP » How to Grab Amazon XML and Post to Your Blog / Site

How to Grab Amazon XML and Post to Your Blog / Site

By Sigit Prasetya Nugroho ∙ August 12, 2014 ∙ PHP ∙ 7 Comments

Share : TwitterFacebookTelegramWhatsapp

I will continue my articles about build amazon affiliate store, and that will be the focus of this article is How to Grab Amazon XML and Post to Your Blog / Site ? . After we get Amazon XML url with API ,  we can get amazon data from that URL. Use this example to get amazon xml url.

I think we all already know how to take the xml data. So I do not need to explain in detail

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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
$A='Your Amazon Xml Url';
if (!@simplexml_load_file($A))
{
echo 'Link tidak valid';
}else
{
  $xml = simplexml_load_file($A);
  $dd=$xml->Items->Item;
  if( !empty($dd))
  {
   $asin='';
   $mediumimage='';
   $largeimage='';
   $detailpage='';
   $feature='';
   $brand='';
   $binding='';
   $listprc='';
   $title='';
   $harga='';
   $custrev='';
   $review='';
   $Manufacturer='';
   $tag='';
   foreach($dd->children() as $child)
   {
    if ($child->getName()=='ASIN')
    { $asin=$child;}
    if ($child->getName()=='DetailPageURL')
    { $detailpage=$child;}
    if ($child->getName()=='LargeImage')
    {
      foreach($child->children() as $url)
      {
        if ($url->getName() == 'URL')
        {$largeimage=$url;}
      }
    }
    if ($child->getName()=='ItemAttributes')
    {
      foreach($child->children() as $url)
      {
        if ($url->getName() == 'Manufacturer')
        { $Manufacturer = $url;}
        if ($url->getName() == 'Binding')
        { $binding=$url;}
        if ($url->getName() == 'Brand')
        { $brand=$url; }
        if ($url->getName() == 'Feature')
        { $feature=$feature.$url.','; }
        if ($url->getName() == 'ListPrice')
        {
           foreach($url->children() as $listprice)
           {
             if ($listprice->getName()== 'FormattedPrice' )
             { $listprc=$listprice; }
           }
        }
        if ($url->getName() == 'Title')
        { $title=$url; }
     }
   }
   if ($child->getName()=='Offers')
   {
     foreach($child->children() as $Offers)
     {
       if ($Offers->getName()=='Offer')
       {
         foreach($Offers->children() as $offer)
         {
           if($offer->getName() == 'OfferListing')
           {
             foreach($offer->children() as $OfferListing)
             {
               if($OfferListing->getName() == 'Price')
              {
                foreach($OfferListing->children() as $Price)
                {
                  if($Price->getName() == 'FormattedPrice')
                  { $harga=$Price; }
                }
              }
             }
           }
         }
       }
     }
   }
if ($child->getName()=='CustomerReviews')
{
   foreach($child->children() as $url)
   {
     if ($url->getName() == 'IFrameURL')
     { $custrev=$url; }
   }
}
if ($child->getName()== 'EditorialReviews')
{
   foreach($child->children() as $EditorialReviews)
   {
     if ($EditorialReviews->getName() == 'EditorialReview')
     {
        foreach($EditorialReviews->children() as $EditorialReview)
        {
          if ($EditorialReview->getName() == 'Content')
          { $feature=$feature.'<div>'.$EditorialReview.'</div>';
        }
     }
   }
}
//put your template layout here
 
//end layout
}
else
{
$dd=$xml->Items->Request->Errors->Error;
$result='';
foreach($dd->children() as $child)
{
   $result=$result.$child.'<br/>';
}
return 'Server response : <br/>'.$result;
}

For Post layout or template, You can creation according to your wishes, As follows is a snippet of my coding

1
2
3
4
5
6
7
8
$result='<div id="kotak" style="width: 60%; height="auto" position: relative;border: 0px #000 solid;" align="center"><div style="border: 0px #000 solid; width: 200px; float: left; height: auto; overflow: hidden; text-align: center; margin-bottom: 10px; position: relative;" align="center"><a href="'.$detailpage.'"><img title="'.$title.'" class="aligncenter" alt="" src="'.$largeimage.'" width="75%" height="auto" /></a></div><div id="row-price" style="border: 0px #000 solid; padding-bottom: 5px; margin-bottom: 10px; overflow: hidden;"><img style="letter-spacing: 0.05em; line-height: 1.6875;" alt="rating" src="'.$urlrating.'" align="left" /><div style="width: 100%; height: 31px;">';
if ($listprc<>'')
{
$result=$result.'<div style="width: 80%; height:auto; text-align: left; float: left;padding-left: 10px; padding-top: 10px;padding-bottom: 10px; margin-top:30px; background-color: #0c6; color: #fff;"><span style="text-decoration: line-through; font: 1.8em "gothamMed";"> Reg Price : '.$listprc.'</span></div>';
}
$result=$result.'</div><div style="font: bold 2.8em ;font-size: 32px; text-align: right; border: 1px solid #ececec; width: 95%; margin-top:10px; float: right;">PRICE : <a href="'.$detailpage.'" title="Click here to check new price from Amazon.com">'.$harga.'</a></div><div class="clear"></div></div><div style="text-align: right; width: 95%; font-size: 10px;">"This Best "<b>'.$title.'</b>" Selling Tends to SELL OUT VERY FAST! MUST HAVE product, be sure to Order Now to avoid disappointment!* Discount only for limited time, <a href="'.$detailpage.'">Buy it now!</a><br/><br/><br/></div><div style="width: 100%;" align="right"><a target="_blank" href="'.$detailpage.'"><img alt="" src="https://1.bp.blogspot.com/-9cgBG-AayzQ/U-BX1prV1RI/AAAAAAAAABc/cGUkntL_jtY/s1600/todayprice.gif" title="Get Special Price at Amazon Now" align="right"/></a></div><div style="width: 100%; float: left;"><div id="tabs" style="list-style: none; overflow: hidden;"><div style="display: block; float: left; border-top: 1px solid transparent; background: #096; padding: 10px 18px; color: #fff; margin-right: 2px;">PRODUCT REVIEW</div></div><span style="color: #333333; font-size: 1.5em; letter-spacing: 0.05em; line-height: 1.6875;">'.$title.'</span><div><img class="slickr-post" alt="'.$title.'" src="'.$largeimage.'" width="20%" title="'.$title.'" /><div style="text-align:justify; ">'.$feature.'</div><a target="_blank" href="'.$detailpage.'"><img alt="" src="https://1.bp.blogspot.com/-3ne0N4K6fJM/U-BX11PZrNI/AAAAAAAAABg/rZWJXoX7kEA/s1600/buy-from-amazon-us.png" title="Get Special Price at Amazon Now" /></a></div><iframe frameborder="0" style="margin-top: 10px;" src="'.$custrev.'" width="100%" height="500px"><p>Your browser does not support iframes.</p></iframe></div></div>';
$hasil='<b>AMAZON Product XML DATA URL :</b> <br/><br/><textarea id="dataarray" rows="5" cols="80">'.$A.'</textarea><br/><br/> <b>LAYOUT HTML CODE : (Copy below url to your post)</b> <br/><br/><textarea id="dataarray" rows="10" cols="80">'.$result.'</textarea><br/><br/> <b>LAYOUT DISPLAY PRODUCT :</b> <br/><br/>'.$result;
return $hasil;

 Try the Grab Amazon XML tools here

Another PHP Related Post :

  • Tutorial Create Simple POS Using ReactJS And Laravel Lumen Part 1
  • How To Replace String With Another String In PHP
  • Login Page – Tutorial CRUD Client and API Server Using JQuery And Lumen Part 2
  • Tutorial CRUD Client and API Server Using JQuery And Lumen Part 1
  • How To Solve Problems Illegal mix of collations (latin1_swedish_ci,IMPLICIT) In Laravel
  • How To Resolve No ‘Access-Control-Allow-Origin’ Header In Lumen

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 WirjaWirja says

    February 26, 2015 at 12:21 am

    Mas Sigit, saya mau nanya. Semoga mas berkenan menjawab.
    Template untuk layout saya pastekan di baris 112
    Kemudian pada baris 1 saya berikan kode php pembuka dan baris 125 dengan kode php penutup.
    Namun setelah di running (saya menggunakan XAMPP di localhost) muncul error
    Parse error: syntax error, unexpected end of file in
    itu apanya ya mas?
    Terima kasih

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      February 26, 2015 at 6:19 am

      Mungkin copy kodenya ada yang kurang }, silahkan dicek lagi script milik mas wirja. 🙂

      Reply
  2. Avatar for DickyDicky says

    March 10, 2015 at 5:15 am

    mas, kok muncul ini ya mas?
    Fatal error: Call to a member function children() on a non-object in /home/minionthemes/public_html/amazon/index.php on line 119? mohon bantuannya mas 🙁

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      March 17, 2015 at 7:04 am

      baris 119 nya mas dicky apa ya ? 🙂

      Reply
  3. Avatar for yudhiyudhi says

    June 2, 2015 at 2:47 pm

    gan, saya coba tool asin grabber-ny disni https://seegatesite.com/tools/azongrabber.php kok tidak muncul ASIN id-nya ya?

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      June 3, 2015 at 8:04 am

      halo yudhi,

      terimakasih sudah mencoba tools saya, kebetulan ada perubahan script html pada situs amazon, sehingga tutorial tersebut tidak bisa berjalan dengan baik. Silahkan coba tutorial yang ini https://seegatesite.com/easy-get-asin-with-my-amazon-asin-grabber-class/ , masih berfungsi dengan baik setelah saya coba.

      terimakasih

      Reply
  4. Avatar for peepntompeepntom says

    March 13, 2018 at 7:54 pm

    can this be done in bulk?

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      March 14, 2018 at 1:20 am

      you can do in bulk using looping 🙂

      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) lumen api (4) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (8) Publisher Tips (5) react (6) Reactjs (9) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




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

©2022 Seegatesite.com