PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of dan boorn   Bing Search   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Bing Search
Search for Web content using the Bing API
Author: By
Last change: Update of example.php
Date: 11 months ago
Size: 989 bytes
 

Contents

Class file image Download
<?php

   
/*
     * sample example code for BingSearch.php class
     * @author Daniel Boorn info@rapiddigitalllc.com
     * @license apache 2.0
     * @bingapiurl https://datamarket.azure.com/dataset/bing/search#schema
     */


   
ini_set('display_errors','1');
    require(
'BingSearch.php');
   
   
//register for key on windows azure
   
$apiKey = 'your api key here';
   
   
$bing = new BingSearch($apiKey);
   
   
# Example 1: simple image search
    /*
    $r = $bing->queryImage('xbox');
    var_dump($r);
    */
   
    # Example 2: advanced image search
    //https://datamarket.azure.com/dataset/bing/search#schema
    //be sure to respect the data types in the values
    /*
    $r = $bing->queryImage(array(
        'Query'=>"'xbox'",//string
        'Adult'=>"'Moderate'",//string
        'ImageFilters'=>"'Size:Small+Aspect:Square'",//string
        'Latitude'=>47.603450,//double
        'Longitude'=>-122.329696,//double
        'Market'=>"'en-US'",//string
        'Options'=>"'EnableHighlighting'",//string
    ));
    var_dump($r);
    */
   
    //repeat examples for other search types...