I am trying to use YQL in php to get product information from Amazon using amazon.prodlist table and Amazon product advertising API.
The query that I used:
select * from amazon.prodlist where Title='harry potter' and SearchIndex='Books' and ResponseGroup='Images,ItemAttributes'
It returns only 10 results. How can I make it display more than 10 results on one page? Also, no pagination.
Full PHP code:
<?php $BASE_URL = "https://query.yahooapis.com/v1/public/yql"; $key="my_key"; $secret="my_secret"; $title="harry potter"; $sindex="Books"; $rgroup="Images,ItemAttributes"; $events=""; // Form YQL query and build URI to YQL Web service $yql_query = "use 'http://www.datatables.org/amazon/amazon.ecs.xml' as amazon.prodlist; set AWSAccessKeyId='$key' on amazon.prodlist; set secret='$secret' on amazon.prodlist; select * from amazon.prodlist where Title='$title' and SearchIndex='$sindex' and ResponseGroup='$rgroup' "; $yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json"; // Make call with cURL $session = curl_init($yql_query_url); curl_setopt($session, CURLOPT_RETURNTRANSFER,true); $json = curl_exec($session); // Convert JSON to PHP object $phpObj = json_decode($json); // Confirm that results were returned before parsing if(!is_null($phpObj->query->results)){ // Parse results and extract data to display foreach($phpObj->query->results->Item as $event){ $events .= "<div><h2>" . $event->ItemAttributes->Title . " by " . $event->ItemAttributes->Author . "</h2></div>"; } } // No results were returned if(empty($events)){ $events = "Sorry, no events matching result"; } // Display results and unset the global array $_GET echo $events; unset($_GET); ?>
This displays 10 results per page. Whereas when I search for βHarry Potterβ in the βBooksβ on the Amazon website, I get over 3,000 results. Is there a way to get all the results on one page? Please inform.
source share