How to Integrate Bing Web Search API in PHP [Updated]

After Google’s web search API getting depreciated, Bing Search API is probably the best option to embed web search functionality into your website. Lets us have a glance over the steps to integrate Bing Web Search API.

Since then, a lot has changed from Bing Azure Interface to implementation methodology, So here I am with the latest tutorial to integrate Bing Web Search and Bing Custom Search API.

Steps to Integrate Bing Web Search API in PHP

Step 1.

The first thing you need to do is to login into Microsoft Azure through the following link:

(if not registered, sign up for a new account) https://portal.azure.com/#create/microsoft.bingsearch

After successful login, you will reach the Azure home page With the following interface:

sign up microsoft azure account

Fill the form as:

Name field: Give a name of your choice (I gave testsearch)
Subscription field: Free Trial
Price Tier: Free 3 TPS 1000 transactions free per month (default with free trial)
Resource Group: You can create a new using the Create new link below the field.
Resource group location: Select one, as per your requirement.

Check confirm and press Create button to finish the process.

Step 2.

You can see the newly created resource under all resources by clicking All Resources (left pane).

all bing resources

Click on testsearch (blue colored).

manage bing keys

Click the link Click here to manage keys, to get the keys.

bing api keys

Step 3.

Finally, just need to replace the key in the following code and you will see the output.

Using Bing Custom Search API

Login into the following URL (with the Microsoft Azure access, as did in Bing web search -> Step 1)

https://www.customsearch.ai

Create New Instance

custom search bing api

Click the Production tab on the top to get the Custom Configuration ID (copy this for further usage)

under the same subscription key.

production bing keys

Click the link at the bottom “Click to issue free trial key”, you will be redirected to

https://portal.azure.com/#create/microsoft.bingcustomsearch

Now follow Step 1 and Step 2 (as in case of Bing web search above) to get the api keys.

And replace the API key and custom configuration key in the following code to get the output.

 

Recommended Posts For You

About Manish Kumar

I am PHP web developer and blogger.

View all posts by Manish Kumar

Leave a Reply to Anonymous Cancel Reply

Your email address will not be published. Required fields are marked *