我正在使用必应搜索图像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>");
}
?>发布于 2014-03-17 07:57:00
根据本文件,可以使用count和offset参数这样做:
http://api.bing.net/xml.aspx?Appid=<AppID>&query=sushi&sources=web&web.count=40&web.offset=41
https://stackoverflow.com/questions/22449061
复制相似问题