是否可以使用bing搜索API获取1000张图像

时间:2014-03-17 07:44:18

标签: php bing

我正在使用 bing搜索图片API

我只从bing收到了10张图片但我需要1000张图片。是否可以检索1000张图像?

请检查我的代码:

<?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>");
}
?>

1 个答案:

答案 0 :(得分:1)

根据this document,您可以使用countoffset参数来执行此操作:

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

相关问题