Search code examples
affiliate

RequestThrottled For Amazon Associates


It looks like my amazon associates account may be banned. No matter how long I wait, I get a 503 error saying 'You are submitting requests too quickly. Please retry your requests at a slower rate.'.

I'm only using this API to get the Title and Image from ASINs.

Is there a better method to get this information? It appears the associates api may be banning me because I haven't had any ad revenue associated with my account.


Solution

  • The information was easy enough to come by with just scraping the page and there's no throttling.

    I'm now using xpath:

    <?php
        $doc = new DOMDocument();
    
        @$doc->loadHTMLFile('https://amazon.com/dp/' . $_GET['asin']);
    
        $xpath = new DOMXPath($doc);
        $title = $xpath->evaluate('//*[@id="productTitle"]');
        $title = trim($title[0]->nodeValue);
    
        $image = $xpath->evaluate('//*[@id="landingImage"]');
        $image = trim($image[0]->getAttribute('src'));
    
        $buybox = $xpath->evaluate('//*[@id="price_inside_buybox"]');
        $buybox = trim($buybox[0]->nodeValue);
    
        die(json_encode([
          'asin'        => $_GET['asin'],
          'title'       => $title,
          'buybox'      => str_replace('$', '', $buybox),
          'image'       => "<img src=\"" . $image . "\" />",
        ]));