public function BiblioEntrezClient::fetchRecords in Bibliography Module 6
Same name and namespace in other branches
- 6.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::fetchRecords()
- 7 modules/pubmed/EntrezClient.php \BiblioEntrezClient::fetchRecords()
- 7.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::fetchRecords()
Returns up to the maximum number of results starting at $retstart found by the previous search.
In order to return results this method must be called after search. The search method retrieves a web environment and query key from the NCBI server which is used to fetch the results. After setting a new search term the old web environment is deleted and search must be executed again before utilizing this method.
The root element of the returned SimpleXML object is PubmedArticleSet.
Parameters
$retStart: the sequential number of the first record retrieved - default=0 which will retrieve the first record
Return value
SimpleXMLElement
Throws
Exception
See also
setReturnMax
2 calls to BiblioEntrezClient::fetchRecords()
File
- pubmed/
EntrezClient.php, line 437 - 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 fetchRecords($retStart = 0, $summaries = FALSE) {
if (is_null($this->webEnvironment)) {
throw new Exception(t('No web environment set.'));
}
$params['WebEnv'] = $this->webEnvironment;
$params['query_key'] = $this->queryKey;
$params['retstart'] = $retStart;
$params['retmax'] = $this
->getReturnMax();
$params['db'] = $this
->getDatabase();
$params['retmode'] = 'xml';
if (isset($this->dateRange)) {
$params['mindate'] = $this
->getMinDate();
$params['maxdate'] = $this
->getMaxDate();
}
if ($summaries) {
$this->query = self::BASE_URL . 'esummary.fcgi?' . http_build_query($params);
}
else {
$this->query = self::BASE_URL . 'efetch.fcgi?' . http_build_query($params);
}
$result = @simplexml_load_file($this->query);
if (isset($result->body->pre->ERROR)) {
return FALSE;
}
return $result;
}