You are here

public function BiblioEntrezClient::fetch in Bibliography Module 6

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

Returns the document identified by the given PubMed ID as a SimpleXMl object. The root element is PubmedArticleSet.

Parameters

int $id:

Return value

SimpleXMLElement

File

pubmed/EntrezClient.php, line 395
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 fetch($id) {
  $params['db'] = $this
    ->getDatabase();
  $params['retmode'] = 'xml';
  $params['id'] = $id;
  $this->query = self::BASE_URL . 'efetch.fcgi?' . http_build_query($params);
  $result = @simplexml_load_file($this->query);
  if (!$result) {
    throw new Exception('Query ' . $this->query . ' failed.');
  }
  return $result;
}