1
我已經使用Bing圖像API下面的代碼來搜索圖像。但代碼只有50個結果。我怎樣才能獲得更多的結果?如何從Bing搜索API獲得超過50個結果?
$acctKey = 'Account key here';
$rootUri = 'https://api.datamarket.azure.com/Bing/Search';
$query = 'Kitchen';
$serviceOp = 'Image';
$market ='en-us';
$query = urlencode("'$query'");
$market = urlencode("'$market'");
$requestUri = "$rootUri/$serviceOp?\$format=json&Query=$query&Market=$market";
$auth = base64_encode("$acctKey:$acctKey");
$data = array(
'http' => array(
'request_fulluri' => true,
'ignore_errors' => true,
'header' => "Authorization: Basic $auth"
)
);
$context = stream_context_create($data);
$response = file_get_contents($requestUri, 0, $context);
$response=json_decode($response);
echo "<pre>";
print_r($response);
echo "</pre>";
可能的[Bing API v1文檔]重複(http://stackoverflow.com/questions/15244280/bing-api-v1-documentation) – 2014-08-28 05:52:14
不完全是重複的,但它解釋說您只能得到50個結果查詢,但您可以使用'skip'參數指定從何處開始(這樣您可以使多個查詢構建一個更大的結果集) – 2014-08-28 05:52:45
當我使用$ requestUri的跳過參數。=「&$ skip = 50 「這是返回空結果 – 2014-08-28 06:08:24