HCG Web Services Documentation
6 July 2009 • Version 1.0

Remote Tags for Search

These remote tags are designed to provide search functionality through a simple tag placed in a remote website.

NOTE: Remote Tags are a restricted service and are intended for use only in websites owned by The Hain Celestial Group. They are not for general use. Please contact Jim Applegate if you need to set up access to Remote Tags.

Base URL : http://rtags.hcgweb.net/v1/search

The HTTP Method used is POST.

Available Tags:

search

Displays a complete search feature including the search dialog box and results. The output from this tag is valid XHTML and is generated by a modified XSL style sheet from the gsa-xhtml-stylesheet project.

The data is received via the GET method but must be submitted via the POST method.

URL Format

http://rtags.hcgweb.net/v1/search/search

Parameter Required Description Options and Samples
site Yes Limits search results to the contents of the specified collection. You can search multiple collections by separating collection names with the OR character, which is notated as the pipe symbol (col1|col2), or the AND character, which is notated as a period (col1.col2).
  • The collection names follow the pattern
    <Site ID>_collection.
  • Each collection needs to set up on the Google appliance. Contact Jim Applegate or David Basch if you need a collection set up.
  • See a complete list of Site ID codes.
cs_collection
action No The URL for where the search tag is processed. This will most likely be the same file the tag is called from initially. $_SERVER['PHP_SELF'];
/search/index.html
Default: search.html

Example Pages

The example pages below show what the tag looks like in action.

CSS and JavaScript

The code

The code below shows all the links needed to have the styles and JavaScript functioning correctly. You may have additional styles sheets and items in the head section of your page, but these are the minimum needed.

There is also specific information about how to use this tag in a Drupal website.

NOTE: the meta tag shown below specifying the character set is important. Without it, special characters will not display correctly.

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

  <title>Search</title>

  <link href="http://resources.hcgweb.net/rtags/css/search.css" rel="stylesheet" type="text/css" media="screen,print" />
  <link href="http://resources.hcgweb.net/rtags/css/search-print.css" rel="stylesheet" type="text/css" media="print" />
  <link href="http://resources.hcgweb.net/rtags/css/search-handheld.css" rel="stylesheet" type="text/css" media="handheld" />
  <!--[if lte IE 7]><link href="http://resources.hcgweb.net/rtags/css/search-ie.css" rel="stylesheet" type="text/css" media="screen,print"/><link href="http://resources.hcgweb.net/rtags/css/search-print-ie.css" rel="stylesheet" type="text/css" media="print"/><![endif]-->
  <!--[if IE 7]><link href="http://resources.hcgweb.net/rtags/css/search-ie7.css" rel="stylesheet" type="text/css" media="screen,print"/><![endif]-->

  <script type="text/javascript" src="http://resources.hcgweb.net/rtags/js/search.js"></script>

</head>

The code below shows how to place the remote tag into your website page using cURL and PHP. Other implementations are possible.

<?php
   $get_array = array();
   $post_vars = '';
   $ch = '';
   $output = '';
   $rtag_url = 'http://rtags-hcgweb:8888/v1/search/search';
   
   $config = array();
   $config['collection'] = "cs_collection";
   $config['action'] = "search.html";
   
   foreach ($config AS $key => $value)
      $get_array[] = $key.'='.$value;
   
   foreach ($_GET AS $key => $value)
      $get_array[] = $key.'='.$value;

   $post_vars = implode('&', $get_array);

   $ch = curl_init($rtag_url);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $output = curl_exec($ch);
   curl_close($ch);
   
   echo $output;
?>