You are here

public function BiblioEntrezClient::post in Bibliography Module 6

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

File

pubmed/EntrezClient.php, line 466
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 post($uids) {
  $params['db'] = $this
    ->getDatabase();
  $params['id'] = implode(',', $uids);
  $this->query = self::BASE_URL . 'epost.fcgi?' . http_build_query($params);
  $headers = array();
  $method = 'POST';
  $result = drupal_http_request($this->query, $headers, $method);
  if ($result->code != 200) {
    throw new Exception('Query ' . $this->query . ' failed.');
  }
  $result = @simplexml_load_string($result->data);
  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;
  }
}