PHP Classes

File: osdescription.php

Recommend this page to a friend!
  Classes of Forud A   Open Search for PHP   osdescription.php   Download  
File: osdescription.php
Role: Example script
Content type: text/plain
Description: example
Class: Open Search for PHP
Add support to a given search engine in a browser
Author: By
Last change: nothing :)
Date: 15 years ago
Size: 1,047 bytes
 

Contents

Class file image Download
<?php
   
require_once ('osearch/opensearch.php');
   
$tmp=new OSDescriptionDoc('Content search','Test description');
   
//$tmp->add_self();
    //$tmp->set_content_type('application/xml');
   
    //This should be a absolute path to url, so we should filnd the path (in your case
    //You can do it any how you like.
   
$protocol=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='')?'https://':'http://';
   
$host=$_SERVER['SERVER_NAME'];
   
$path=dirname($_SERVER['PHP_SELF']);
   
$full_path=$protocol.$host.$path.'/';
   
//

   
$tmp->add_url($full_path .'search.php' .'?q={searchTerms}&amp;src={referrer:source?}&amp;dtstart={time:start?}&amp;dtend={time:stop?}','text/html') ;
   
$tmp->add_suggestions($full_path . 'sugestext.php?q={searchTerms}');
   
//$tmp->add_image_base64('favicon.png','',16,16);
    //or
   
$tmp->add_image($full_path .'favicon.png','',16,16);
   
$tmp->add_language('*');
   
$tmp->need_referrer_extension(true);
   
$tmp->need_time_extension(true);
   
$tmp->serve();
   
//$tmp->save_to_file('opensearch.xml');
?>