public function BiblioEntrezClient::search in Bibliography Module 6
Same name and namespace in other branches
- 6.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::search()
- 7 modules/pubmed/EntrezClient.php \BiblioEntrezClient::search()
- 7.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::search()
Returns up to the maximum number of items from the result set starting at $retstart.
If this is the first search for a given term a web environment and a query key is retrieved from the NCBI server in addition to the result set. See http://eutils.ncbi.nlm.nih.gov/corehtml/query/static/esearch_help.html
Parameters
int $retStart: the sequential number of the first record retrieved - default=0 which will retrieve the first record
Return value
SimpleXMLElement an array of PubMed IDs
Throws
Exception
See also
setReturnMax
setRelativeDate
File
- pubmed/
EntrezClient.php, line 316 - 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 search($retStart = 0) {
if (!is_null($this->webEnvironment)) {
$params['WebEnv'] = $this->webEnvironment;
$params['query_key'] = $this->queryKey;
}
else {
$params['usehistory'] = $this->useHistory;
$params['tool'] = $this
->getTool();
$params['email'] = $this
->getEmail();
$params['term'] = $this
->getTerm();
}
if (isset($this->dateRange)) {
$params['mindate'] = $this
->getMinDate();
$params['maxdate'] = $this
->getMaxDate();
}
$params['retstart'] = $retStart;
$params['retmax'] = $this
->getReturnMax();
$params['db'] = $this
->getDatabase();
$this->query = self::BASE_URL . 'esearch.fcgi?' . http_build_query($params);
$result = @simplexml_load_file($this->query);
if (!$result) {
throw new Exception('Query ' . $this->query . ' failed.');
}
if (isset($result->WebEnv)) {
$this->webEnvironment = (string) $result->WebEnv;
$this->queryKey = (int) $result->QueryKey;
$this->count = (int) $result->Count;
}
return $result;
}