Skip to content
This repository has been archived by the owner. It is now read-only.
An API for querying Pubmed
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
1-fetchdata.php Update 1-fetchdata.php Jul 5, 2014
2-parsedata.php Clean up Jul 5, 2014
3-analysis.php Update Jul 5, 2014
lib.pubmed.php Create lib.pubmed.php Jun 21, 2014

Pubmed API

This API grew out of my analysis of scientific authorship over the last century, published here.

Sample Code

Query abstracts of 100 papers published in 1973

// Initialize
include "lib.pubmed.php";
$query = new Pubmed();

// Query Pubmed for 100 papers published in 1973
// See for query information
$result = $query->esearch( Array( 'term'     => '1973[pdat]',
                                  'retmax'   => 100,          // Max fields to return is 100
                                  'retstart' => 0)            // Return first results 

// Output is IDs of papers
$paperIDs = (array) $result->IdList;

// Prepare next query to fetch abstract (first, make list of the 100 paper IDs)
$strPaperIDs = '';
foreach($paperIDs as $articleID)
	$strPaperIDs .= (string) $articleID;

// Query Pubmed for abstracts (and paper title/author list/etc)
// Returns XML file (set last argument to true to return SimpleXML object)
$articleAbstracts = $query->efetch( Array( 'id'      => $strPaperIDs,
                                           'retmode' => 'xml',
                                           'rettype' => 'abstract'
                                          ), false);

// Output



  • lib.pubmed.php: This is the library file
  • 1-fetchdata.php: Fetch XML abstract listings of all papers published between 1913 and 2013
  • 2-parsedata.php: Extracts authorship distribution for each year
  • 3-analysis.php: Calculates average/median/max number of author per year
You can’t perform that action at this time.