Login   Register  
PHP Classes
elePHPant
Icontem

File: testyahooboss.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Shah Hastimal  >  Yahoo Boss  >  testyahooboss.php  >  Download  
File: testyahooboss.php
Role: Example script
Content type: text/plain
Description: example
Class: Yahoo Boss
Perform searches using the Yahoo Boss API
Author: By
Last change:
Date: 2008-07-24 04:34
Size: 2,341 bytes
 

Contents

Class file image Download
<?php 
  
include("yahooboss.class.php");
  
    if (
$_GET['s'] == '') { ?>
<form method="get" style="margin-bottom:30px; margin-top:20px;">
<input type="text" name="s" size="30" /> <input type="submit" value="Search" />
<select name="searchtype">
    <option value="WEB">WEB
    <option value="IMAGES">IMAGES
    <option value="NEWS">NEWS
</select>
</form>
<?php ?>

<?php
if ($_GET['s'] != '') {
    
$yahoo   = new YahooBoss();
    
$thequery urlencode($_GET['s']);
    
$format  'xml';

$searchtype $_GET['searchtype'];

switch(
$searchtype)
{
    case 
"NEWS":
            
$results $yahoo->YahooNewsSearch($thequery,$format);
            foreach (
$results->resultset_news->result as $theresult) {
                    echo 
'Title :- '.$theresult->title.'<br/>';
                    echo 
'Click Url :- <a href="'.$theresult->clickurl.'">'.$theresult->clickurl.'</a><br/>';
                    echo 
'Abstract :- '.$theresult->abstract.'<br/>';
                    echo 
'Date :- <small><i>'.$theresult->date.'</i></small><br/>';
                    echo 
'Time :- <small><i>'.$theresult->time.'</i></small><br/>';
                    echo 
'Url :-<small><i>'.$theresult->url.'</i></small><br/>';
                    echo 
'<br/><br/>';
                }
            break;
    case 
"WEB":
            
$results $yahoo->YahooWebSearch($thequery,$format);
            foreach (
$results->resultset_web->result as $theresult) {
                    echo 
'Title :- '.$theresult->title.'<br/>';
                    echo 
'Click Url :- <a href="'.$theresult->clickurl.'">'.$theresult->clickurl.'</a><br/>';
                    echo 
'Abstract :- '.$theresult->abstract.'<br/>';
                    echo 
'DeepUrl :- <small><i>'.$theresult->deepurl.'</i></small><br/>';
                    echo 
'Url :- <small><i>'.$theresult->url.'</i></small><br/>';
                    echo 
'<br/><br/>';
                }
            break;

        case 
"IMAGES":
            
$results $yahoo->YahooImagesSearch($thequery,$format);
            
//print_r($results);die("am here");
            
foreach ($results->resultset_images->result as $theresult) {
                    echo 
'Title :- '.$theresult->title.'<br/>';
                    echo 
'Click Url :- <a href="'.$theresult->clickurl.'">'.$theresult->clickurl.'</a><br/>';
                    echo 
'Abstract :- '.$theresult->abstract.'<br/>';
                    echo 
'Date :- <small><i>'.$theresult->date.'</i></small><br/>';
                    echo 
'Thumbnail :- <small><i><img src='.$theresult->thumbnail_url.'/></i></small><br/>';
                    echo 
'Url :-<small><i>'.$theresult->url.'</i></small><br/>';
                    echo 
'<br/><br/>';
                }
            break;
}

}

?>