suresh
suresh

Reputation: 162

Is It possible to get 1000 images using bing search API

I'm using bing search image API.

I received only 10 images from bing But I need 1000 images. Is It possible to retrieve 1000 images ?

Kindly check my code :

<?php
if (isset($_POST['submit'])) {
 $Key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; // this is my api key
 $request ='http://api.bing.net/json.aspx?Appid=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&sources=image&query=' . urlencode( $_POST["searchText"]);
 $response = file_get_contents($request);
 $jsonobj = json_decode($response);
 echo('<ul ID="resultList">');
 foreach($jsonobj->SearchResponse->Image->Results as $value){
  echo('<li class="resultlistitem"><a href="' . $value->Url . '">');
  echo('<img src="' . $value->Thumbnail->Url. '" width="150" height="150"></li>'); 
 }
 echo("</ul>");
}
?>

Upvotes: 1

Views: 1305

Answers (1)

Tony Dinh
Tony Dinh

Reputation: 6726

According to this document, you can use count and offset parameter to do that:

http://api.bing.net/xml.aspx?Appid=<AppID>&query=sushi&sources=web&web.count=40&web.offset=41

Upvotes: 1

Related Questions