开发者

How do I generate a listing of article names and e-mail addresses from pubmed results?

I want to generate a listing of (1) article titles and (2) article author e-mail addresses all from pubmed search results. Using the pubmed EFetch ultility (see this link for details: http://www.ncbi.nlm.nih.gov/corehtml/query/static/efetchlit_help.html) I have successfully created a php script to retrieve this data in an xml format as follows...

<?php

$query = '"genetics"[MeSH] AND "Nature"[TA]';

$params = array(
  'db' => 'pubmed',
  'retmode' => 'xml',
  'retmax' => 1,
  'usehistory' => 'y',
  'term' => $query,
  );

$xml = simplexml_load_file('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?' . http_build_query($params));

$params = array(
  'db' => 'pubmed开发者_运维知识库',
  'retmode' => 'xml',
  'query_key' => (string) $xml->QueryKey,
  'WebEnv' => (string) $xml->WebEnv,
  'rettype' => 'full',
  'retmax' => 10,
  );

$xml = simplexml_load_file('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?' . http_build_query($params));

print_r ($xml);

?>

However, I am having trouble resolving two issues.

(1) E-mail addresses do not have their own xml field, as you can see if you review the output generated by my example. Therefore, how do I extract those addresses from the xml?

(2) Once that is accomplished, how do I create an html listing of article titles, followed beneath it by the associated e-mail address?

Thank you in advance for your help!


I ran your script, and I don't see a single email address in the output.

Either way, the easiest way to accomplish what you're trying is to get the XML, and then apply a very simple XSL transformation (XSLT) against the XML that's returned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜