我正在使用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>");
}
?>
根据本文档,您可以使用count
和offset
参数来完成:
http://api.bing.net/xml.aspx?Appid=<AppID>&query=sushi&sources=web&web.count=40&web.offset=41