Example #1
0
 /**
  * Ensures that the query API throws an exception when the category is invalid
  *
  * @return void
  */
 public function testQueryExceptionCategoryInvalid()
 {
     $this->setExpectedException(
         'Zend\Service\Amazon\Exception\RuntimeException',
         'The value you specified for SearchIndex is invalid.'
     );
     $this->_query->category('oops')->search();
 }
Example #2
0
 /**
  * Ensures that the query API throws an exception when the category is invalid
  *
  * @return void
  */
 public function testQueryExceptionCategoryInvalid()
 {
     try {
         $this->_query->category('oops')->search();
         $this->fail('Expected Zend_Service_Exception not thrown');
     } catch (Zend_Service_Exception $e) {
         $this->assertContains('SearchIndex is invalid', $e->getMessage());
     }
 }
        ?>
</option>
                            <?php 
    }
}
?>
                </select>
            </label>
            <input type="submit" value="Search!">
        </p>
    </form>
<?php 
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
    $amazon = new Zend_Service_Amazon_Query("1338XJTNFMTHK413WFR2");
    try {
        $amazon->category($searchFor)->ResponseGroup('Large')->Keywords($keywords);
        $results = $amazon->search();
        if ($results->totalResults() > 0) {
            echo '<div id="results">';
            echo '<h2>Search Results</h2>';
            foreach ($results as $result) {
                echo "<div>";
                echo "<h3>{$result->Title}</h3>";
                if (isset($result->MediumImage)) {
                    ?>
                        <div class="thumb">
                            <a href='<?php 
                    echo $result->DetailPageURL;
                    ?>
' title='<?php 
                    echo $result->Title;