You are here

public function BiblioEntrezClient::getAvailableDatabases in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::getAvailableDatabases()
  2. 7 modules/pubmed/EntrezClient.php \BiblioEntrezClient::getAvailableDatabases()
  3. 7.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::getAvailableDatabases()

Returns the available entrez databases from EInfo.

Return value

array

Throws

Exception

File

pubmed/EntrezClient.php, line 112
EntrezClient.php Provides Entrez client to retrieve items from the NCBI databases Orginally writen by Stefan Freudenberg

Class

BiblioEntrezClient
@file EntrezClient.php Provides Entrez client to retrieve items from the NCBI databases Orginally writen by Stefan Freudenberg

Code

public function getAvailableDatabases() {
  $databases = array();
  $url = self::BASE_URL . 'einfo.fcgi';
  $result = @simplexml_load_file($url);
  if (!$result) {
    throw new Exception('Query ' . $url . ' failed.');
  }
  if (isset($result->DbList->DbName)) {
    foreach ($result->DbList->DbName as $name) {
      $databases[] = (string) $name;
    }
  }
  return $databases;
}