Sequences
Fetch FASTA for a transcript and its protein product (GIs 312836839 and 34577063)
Gene
Fetch full XML record for Gene ID 2:
#!/usr/bin/php
function pubmed_fetch($query){
$ret=1;
$flag=0;
$flag_xml=0;
print "Searching for: $query\n";
$pubmedtime=getdate();
$pubmedyear=$pubmedtime['year'];
$pubmedmonth=$pubmedtime['mon'];
$pubmedday=$pubmedtime['mday'];
$params = array(
'db' => 'pubmed',
#'retmode' => 'xml',
'retmode' => 'summary',
'retmax' => 1,
'usehistory' => 'y',
'term' => $query,
);
$url = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?' . http_build_query($params); print "URL: $url\n";
$xml = simplexml_load_file($url);
pubmed_errors($xml);
print("$xml\n");
if (!$count = (int) $xml->Count){
print "No items found!\n";
return 0;
}