Location: PHPKode > projects > Taxonomic Search Engine > namesearch.php
<?php

// $Id: namesearch.php,v 1.1.1.1 2005/05/19 10:31:10 rdmpage Exp $

require_once("config.inc.php");
require_once("lib.xml.inc.php");
require_once("Net/HTTP/Client.php");
require_once("lib/nusoap.php");
require_once("XPath.class.php");
require_once("xslt.php");

require_once("wrapper.php");
require_once("itis_wrapper.php");
require_once("funindex_wrapper.php");
require_once("ipni_wrapper.php");
require_once("ubio_wrapper.php");
require_once("ncbi_wrapper.php");

function NameSearch ($search_string)
{
	// Check we have a name
	if($search_string == '')
	{
		return new soap_fault('Client','','Must supply a taxon name.');
	}
	
	// Create wrappers
	$itis = new ITISWrapper;
	$fundex = new FunindexWrapper;
	$ipni = new IPNIWrapper;
	$ubio = new uBioWrapper;
	$ncbi = new NCBIWrapper;


	// Build a search result
	$search_result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
	$search_result .= "<NameSearchResults>\n";
	
	// Query terms
	$search_result .= "<NameSearchQuery>\n";
	$search_result .= "   <name>" . $search_string . "</name>\n";
	$url_friendly .= ereg_replace (" " ,"%20" ,$search_string );
	$search_result .= "   <name_escaped>" . $url_friendly . "</name_escaped>\n";


	$search_result .= "</NameSearchQuery>\n";




	// ITIS
	if (1)
	{
		$tmp = $itis->NameSearch($search_string,1);
		// Strip XML header
		$search_result .= preg_replace ("/<\?xml(.*?)\?>/", "", $tmp);
	}
	
	// IndexFung
	//if (isset($include_IF))
	if (1)
	{
		$tmp = $fundex->NameSearch($search_string, EXACT, 1);
		// Strip XML header
		$search_result .= preg_replace ("/<\?xml(.*?)\?>/", "", $tmp);
	}
	
	
	// IPNI
	if (1)
	{
		$tmp = $ipni->NameSearch($search_string,1);
	
		// Strip XML header
		$search_result .= preg_replace ("/<\?xml(.*?)\?>/", "", $tmp);
	}
	
	
	// uBio
	if (1)
	{
		$tmp = $ubio->NameSearch($search_string,1);
	
		// Strip XML header
		$search_result .= preg_replace ("/<\?xml(.*?)\?>/", "", $tmp);
	}
	
	// NCBI
	if (1)
	{
		$tmp = $ncbi->NameSearch($search_string,1);
	
		// Strip XML header
		$search_result .= preg_replace ("/<\?xml(.*?)\?>/", "", $tmp);
	}
	
	$search_result .= "</NameSearchResults>";

	return $search_result;
}

?>
Return current item: Taxonomic Search Engine