我正在尝试使用 bing api 密钥搜索一些图像。我写了这段代码,但它不起作用,并且它不会返回一些错误。我认为这是一个 api 错误......你能帮帮我吗?
$accountKey = 's+s/s=';
$rootUri = 'https://api.datamarket.azure.com/Bing/Search';
// Get the query. Default to 'sushi'.
$query = ($_GET['q']) ? $_GET['q'] : 'sushi';
// Get the service operation. Default to Web.
$serviceOp = ($_GET['sop']) ? $_GET['sop'] : 'Web';
// Get the market. Default to en-us.
$market = ($_GET['market']) ? $_GET['market'] : 'en-us';
$ServiceRootURL = 'https://api.datamarket.azure.com/Bing/SearchWeb/';
$WebSearchURL = $ServiceRootURL . 'Web?$format=json&Query=';
$request = $WebSearchURL . urlencode( '\'' . $query. '\'');
echo $request;
//$requestUri = "$rootUri/$serviceOp?\$format=json&Query=$query&Market=$market";
$process = curl_init($request);
curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($process, CURLOPT_USERPWD, $accountKey . ":" . $accountKey);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($process);
$jsonobj = json_decode($response);
echo "<br>Ris = ".$jsonobj;