I can not install Bing Search API v7
In the Azure Portal,
Go to Subscriptions > Select Your Subscription > Resource Providers > Search for Microsoft.Bing
and it's status will be unregistered so that Pricing tiers are not visible to your subscription.
Register that resource provider with your subscription and refresh your browser page (Azure Portal) to get pricing tiers list.
Bing search API and Azure
Documentation for new services can get a bit interesting - especially in the rabbit-warren of MSDN. The most clear explanation I can find is on the Migration Guide from this Bing Search API page. Best of all the migration guide has a nice simple example in PHP towards the end.
EDIT: Alright, the migration guide is a starting point, but it isn't the best example. Here are two methods that work for me (no proxy, firewalls etc. interfering):
Using file_get_contents
Note: 'allow_url_fopen' needs to be enabled for this to work. You can use ini_set (or change php.ini etc.) if it isn't.
if (isset($_POST['submit']))
{
// Replace this value with your account key
$accountKey = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=';
$ServiceRootURL = 'https://api.datamarket.azure.com/Bing/Search/';
$WebSearchURL = $ServiceRootURL . 'Web?$format=json&Query=';
$cred = sprintf('Authorization: Basic %s',
base64_encode($accountKey . ":" . $accountKey) );
$context = stream_context_create(array(
'http' => array(
'header' => $cred
)
));
$request = $WebSearchURL . urlencode( '\'' . $_POST["searchText"] . '\'');
$response = file_get_contents($request, 0, $context);
$jsonobj = json_decode($response);
echo('<ul ID="resultList">');
foreach($jsonobj->d->results as $value)
{
echo('<li class="resultlistitem"><a href="'
. $value->URL . '">'.$value->Title.'</a>');
}
echo("</ul>");
}
Using cURL
If cURL is installed, which is normal these days:
<?php
$query = $_POST['searchText'];
$accountKey = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
$serviceRootURL = 'https://api.datamarket.azure.com/Bing/Search/';
$webSearchURL = $serviceRootURL . 'Web?$format=json&Query=';
$request = $webSearchURL . "%27" . urlencode( "$query" ) . "%27";
$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);
$response = json_decode($response);
echo "<ol>";
foreach( $response->d->results as $result ) {
$url = $result->Url;
$title = $result->Title;
echo "<li><a href='$url'>$title</a></li>";
}
echo "</ol>";
?>
[WTS] changed SearchWeb to Search.
Cant find Bing image search api in azure console
You need to create a New Bing Search service from the Azure portal. Goto your portal and type Bing search in the search bar,
Once the resource is created, you can get the keys by navigating as follows,
Azure Bing Web Search api , retrieve metadata
This information seems that it's not returned by API and there's no parameter to add this information in responses right now, tested on API v7.0.
Cannot find bing news search api resource in azure market place
You can access it from Azure Portal by clicking on Create Resource => Search Bing Search V7 APIs => Create.
You can access it from Azure Portal by clicking on All Services => Marketplace => Search Bing Search V7 APIs => Create
Note: The free trial is sufficient for this quickstart. You need the access key provided when you activate your free trial, or you may use a paid subscription key from your Azure dashboard.
For more details, refer "Bing New Search Documentation"
What is the difference between Azure Search and Bing Search and what to use when?
Azure Search service is not part of the Cognitive services but Bing search is part of Azure Cognitive Services as per my knowledge.
Yes, Bing search is Azure Cognitive Services while Cognitive search is a preview feature of Azure Search, supported in these regions.
Where can I find detail comparison and guidance?
Bing Web Search API searches the indexes on Bing.com
for matching terms you submit. Indexes are built from HTML, XML, and other web content on public sites. Built on the same foundation, Bing Custom Search offers the same crawler technology for web content types, scoped to individual web sites.
Azure Search searches an index you define, populated with data and documents you own, often from diverse sources. Azure Search has crawler capabilities for some data sources through indexers, but you can push any JSON document that conforms to your index schema into a single, consolidated searchable resource.
For more details, you could refer to this article.
What are the advantages of Azure Search service over Bing search in this case?
Easily add sophisticated cloud search capabilities to your website or application using the same integrated Microsoft natural language stack which is used in Bing and Office and which has been improved over 16 years. Quickly tune search results and construct rich, fine-tuned ranking models to tie search results to business goals. Reliable throughput and storage give you fast search indexing and querying to support time-sensitive search scenarios. Please refer to this article.
Related Topics
Differencebetween Null and Empty
How to Check If Variable Is Array... or Something Array-Like
Try Catch Cannot Work with Require_Once in PHP
How to Maintain Session in Curl in PHP
How to Set a Maximum Size Limit to PHP Curl Downloads
When and Why Should $_Request Be Used Instead of $_Get/$_Post/$_Cookie
PHP - Flushing While Loop Data with Ajax
Multiple Forms and One Processing Page
Sort an Array with Special Characters in PHP
Adding Multiple Items to Woocommerce Cart at Once
What's the Difference Between Is_Null($Var) and ($Var === Null)
PHP Equivalent of Friend or Internal
How to Use C++ Binaries from PHP
PHP - Time Remaining Until Specific Time from Current Time of Page Load
Do PHP Pdo Prepared Statements Need to Be Escaped