title: amazon product advertising api get product with offers
body: <p>I am using Amazon product advertising API. I want get product which has offer.</p>
  
  <p>I tried the amazon-api php class to get the data,  but it doesn't work properly.</p>
  
  <p>Need Help to get the products which has an offer.</p>
  
  <pre><code>    &lt;?php
  
      require_once 'aws_signed_request.php';
  
  class AmazonProductAPI
      {
  
    private $public_key     = "YOUR AMAZON ACCESS KEY ID";
    private $private_key    = "YOUR AMAZON SECRET KEY";
  
  /* 'Associate Tag' now required, effective from 25th Oct. 2011 */
  private $associate_tag  = "YOUR AMAZON ASSOCIATE TAG";
  
  const MUSIC = "Music";
  const DVD   = "DVD";
  const GAMES = "VideoGames";
  
    private function verifyXmlResponse($response)
     {
      if ($response === False)
      {
          throw new Exception("Could not connect to Amazon");
      }
      else
      {
          if (isset($response-&gt;Items-&gt;Item-&gt;ItemAttributes-&gt;Title))
          {
              return ($response);
          }
          else
          {
              throw new Exception("Invalid xml response.");
          }
      }
      }
  
    private function queryAmazon($parameters)
     {
      return aws_signed_request("com",
                                $parameters,
                                $this-&gt;public_key,
                                $this-&gt;private_key,
                                $this-&gt;associate_tag);
  }
  
  public function searchProducts($search,$category,$searchType="UPC")
  {
      $allowedTypes = array("UPC", "TITLE", "ARTIST", "KEYWORD");
      $allowedCategories = array("Music", "DVD", "VideoGames");
  
      switch($searchType) 
      {
          case "UPC" :
              $parameters = array("Operation"     =&gt; "ItemLookup",
                                  "ItemId"        =&gt; $search,
                                  "SearchIndex"   =&gt; $category,
                                  "IdType"        =&gt; "UPC",
                                  "ResponseGroup" =&gt; "Medium");
                          break;
  
          case "TITLE" :
              $parameters = array("Operation"     =&gt; "ItemSearch",
                                  "Title"         =&gt; $search,
                                  "SearchIndex"   =&gt; $category,
                                  "ResponseGroup" =&gt; "Offers");
                          break;
  
      }
  
      $xml_response = $this-&gt;queryAmazon($parameters);
  
      return $this-&gt;verifyXmlResponse($xml_response);
  
  }
  
  }
  </code></pre>
  
  <p>any help would be appreciated.</p>