简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM