Bing API PHP

Get the new updates at the project homepage in codeplex.

Well, since the opening of bing.com I’ve been playing with the API and some of the options it provides. Certainly I was getting annoyed since I had to rebuild each of my queries if I wanted something so I search for a library that could do this for me which I couldn’t find and I ended up writing my own.

Requirements: PHP5 and cURL

How to use this API? Here is a simple demonstration


// Include the Bing API PHP Library
require_once 'library/BingAPI.php';

// Simply start the class with your AppID argumented
$search = new BingAPI('YOUR APPID KEY');

// Build your query easily
/* To use multiple resources simply do ->setSources('Web+Image') ,
   it must match the source type
   bling.com provides */
$search->query('gimp')
       ->setSources('Web')
       ->setFormat('xml') /* Also you can try: xml, soap or json */
       ->setOptions(
             array(
                  'Web.Count' => '10',
                  'Web.Offset' => '0',
                  'Adult' => 'Moderate',
                  'Options' => 'EnableHighlighting')
    );
/* Check the API documentation in bing.com for more information */

/* This will give you a raw output */
echo $search>getResults();

I’d hope this little library makes your life easier :) Soon there’ll be a tracker if there are problems with it or you can comment here.

Download it now | Check the documentation | Get a Developer API Key

Heads up: There will be soon a better way to issue bugs

Any issues: http://bingapiphp.codeplex.com/WorkItem/List.aspx
Project Homepage

About SOAP Implementation

It seems I have made silly mistake with SOAP, there is actually no current SOAP implementation and it will be supplied soon.

8 people like this post.

7 Responses to “Bing API PHP”

  1. TuVinhSoft says:

    Wow. Very useful PHP Lib. I will download and try to use it. Of course will tweet this.

  2. [...] Bing API PHP Comparteme These icons link to social bookmarking sites where readers can share and discover new web pages. [...]

  3. [...] para busquedas, y he aqui donde encontre una libreria en PHP para este mismo desarrollado por  David González los requisitos para usar la API son PHP [...]

  4. [...] se encuentra disponible API PHP para el nuevo buscador de Microsoft, Bing. De hecho personalmente opino que lo resultados de las [...]

  5. Funthomas says:

    It is cool, congratulation.

Leave a Reply