You are here

public function BiblioEntrezClient::post in Bibliography Module 7

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

File

modules/pubmed/EntrezClient.php, line 488
Provides Entrez client to retrieve items from the NCBI databases.

Class

BiblioEntrezClient

Code

public function post($uids) {
  $params['db'] = $this
    ->getDatabase();
  $params['id'] = implode(',', $uids);
  $this->query = self::BASE_URL . 'epost.fcgi?' . http_build_query($params);
  $request_options = array(
    'method' => 'POST',
  );
  $result = drupal_http_request($this->query, $request_options);
  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;
  }
}