function run_script($controller, $params)
{
    $out = array();
    $results = Google::search($params['query']);
    foreach ($results as $result) {
        $out[] = $result['title'] . "\n\t" . $result['url'] . "\n\t\t" . $result['note'];
    }
    $controller->ok(implode("\n\n", $out));
}
Beispiel #2
0
 public function on_google_search($pars)
 {
     self::setResult(Google::search($pars['query']));
 }
Beispiel #3
0
 function google()
 {
     $this->set('title', 'Google');
     $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text'));
     $this->expect(extension_loaded('sockets'), 'Sockets extension available', 'Sockets extension is not active - unable to continue');
     if (extension_loaded('sockets')) {
         $this->expect(TRUE, 'Google map<br/><img src="/google/map" alt="Google Map"/>');
         $search = Google::search('google');
         $this->set('QUIET', TRUE);
         $this->expect(is_array($search), 'Google search generated the following results:<br/>' . implode('<br/>', $this->pick($search['results'], 'url')), 'Google search failure: ' . var_export($search, TRUE));
         $this->set('QUIET', FALSE);
         $geocode = Google::geocode('1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA');
         $this->set('QUIET', TRUE);
         $this->expect(is_array($geocode), 'Geocode API call success', 'Geocode API call failure: ' . var_export($geocode, TRUE));
         $this->set('QUIET', FALSE);
     }
     echo $this->render('basic/results.htm');
 }
Beispiel #4
0
<?php

require_once 'bing.class.php';
require_once 'google.class.php';
if (isset($_GET['search'])) {
    $q = $_GET['search'];
} else {
    $q = 'MooTools';
}
$appid = '49EB4B94127F7C7836C96DEB3F2CD8A6D12BDB71';
$obj = new Bing($appid);
$obj->search($q);
$bing = $obj->getHTML();
$obj2 = new Google($appid);
$obj2->search($q);
$google = $obj2->getHTML();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
   <title>GooBing - Search Google and Bind in one go</title>
   <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
   <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/base/base.css" type="text/css">
   <style type="text/css">
    html,body{color:#fff;background:#222;font-family:calibri,verdana,arial,sans-serif;}
    h1{font-size:300%;margin:0;text-align:right;color:#3c3}
    h2{background:#369;padding:5px;color:#fff;font-weight:bold;-moz-box-shadow: 0px 4px 2px -2px #000;-moz-border-radius:5px;-webkit-border-radius:5px;text-shadow: #000 1px 1px;}
    h3 a{color:#69c;text-decoration:none;}
    h3{margin:0 0 .2em 0}
    .info{font-size:200%;color:#999;margin:1em 0;}