From mediawiki.org
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: stable
Implementation Tag
Description Fetches literature data from PubMed (www.pubmed.org) by API and includes them into a page.
Author(s) Andreas Bohne-Lang (Bohnelangtalk)
Latest version 2.0 (2018-10-31)
MediaWiki 1.28+
PHP 5.6+
Database changes No
License GNU General Public License 2.0 or later
Download external source
  • $wgPubmedCache
  • $wgPubmedLimit
  • $wgPubmedDEBUG
  • $wgPubmedOffset
  • $wgPubmedPath
  • $wgPubmedLayoutFile
  • $wgPubmedLayoutLinks
  • $wgPubmedProxyHost
  • $wgPubmedProxyPort
  • $wgPubmedProxyUser
  • $wgPubmedProxyPass
  • $wgPubmedSOAP (deprecated)
  • $wgNUSOAPencodinghack (deprecated)

Check usage and version matrix.

The Pubmed extension can fetch literature data from scientific articles stored in PubMed (www.pubmed.org), and generate a reference list or box. The extension can create, in addition to the primary data like author, article title, journal, year, pages, etc., links like back to PubMed or to WorldCat.org by ISSN or to the full text at the publisher's page (if a DOI is specified). Further links can be defined using the layout template.


<pubmed> PubMed-ID or search string </pubmed>


<pubmed> 15980568 </pubmed> will result:

Andreas Bohne-Lang, Wolf-Dieter Groch, René Ranzinger
AISMIG--an interactive server-side molecule image generator.
Nucleic Acids Res.: 2005, 33(Web Server issue);W705-9
[PubMed:15980568] [WorldCat.org] [DOI] (I p)

Pubmed can be combined quite elegantly with the Cite extension to produce in-text citations and an automatically numbered list of PubMed references, like the following:

<ref><pubmed>18981297 10901739</pubmed></ref>

In combination with Cite, and because Cite displays references as numbered lists, an inline format for the citation (like here) might be more suitable than the two default options. To achieve this, simply edit the file layout_ext.def in the Pubmed/layouts/ folder or create your own layout file in the same folder. In the latter case, also remember to a) redefine your default layout file (see Configuration parameters below) and b) duplicate the DOI, PMID and WORLDCAT files and rename them accordingly, in order to achieve display and automatic hyperlinking of those three fields to work with your custom format.

Further examples
  • <pubmed>Cancer</pubmed>
  • <pubmed>12743656,12061127,11928483,11752350,10498779,11114093</pubmed>


  1. Please download archive from link in the box on the right side.
  2. untar the archive, ex tar zxvf Pubmed.tar.gz.
  3. place "Pubmed" directory in $IP/extensions/.

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.


To install this extension, add the following to LocalSettings.php:



//$wgPubmedSOAP="auto";       *Deprecated*
//$wgNUSOAPencodinghack=true; *Deprecated*

The PHP parameter allow_url_fopen = On needs to be set in your servers "php.ini" file for this extension to work. Usually this setting is deactivated because of security considerations.


$wgPubmedCache="/tmp/pubmedcache"; enables cacheing of the Pubmed article data in a directory

$wgPubmedLimit=0; means that you get all articles a search query returns (remember the Pubmed limit of 500 articles) $wgPubmedLimit=10 sets the global limit of max retrieved articles to ten / <pubmed limit=20> can override the global setting

$wgPubmedLayoutFile="layout_ext.def"; sets the global default layout file<pubmed layoutfile="layout_ext2.def"> can override the default setting

$wgPubmedLayoutLinks="PMID,WORLDCAT,EZB,DOI"; sets default link includes

<pubmed limit=12> ... </pubmed> sets a limit of max data set that should be listed if there are more than one

<pubmed layoutfile="layout_ext2.def" layoutlinks="PMID,WORLDCAT,EZB_HD"> ... </pubmed> sets an alternative layout template file

Tips & Tricks[edit]

  • Fetch the latest 15 really published (not EPub ahead of print) publications from your department
<pubmed limit=15> "Medical Faculty Mannheim"[AD] AND "2011"[DP] AND pubstatusppublish </pubmed>
  • Latest publication about "real" science ;-)
<pubmed> 21133407, 6418270, 7819986 </pubmed>


Version 1 - SOAP interface

  • 01.12.2008: small bugfix in SOAP class
  • 07.07.2009: Add ProxyUser and ProxyPassword to code area that handles a SOAP proxy connection
  • 28.04.2010: Try to code a work around for the mismatch encoding information in the SOAP-data coming from Pubmed. Adding 2 new variables: $wgPubmedSOAP="nusoap"; that can be "auto or nusoap" and $wgNUSOAPencodinghack=true; At the moment only $wgPubmedSOAP="nusoap" is working correctly.
  • 28.12.2010: Fix Pubmed changing in Title: Unfixed 'Array' occurs in titel. This is fixed in layout.inc.php now.
  • 08.02.2011: Fix Pubmed changing in ["MedlineCitation"]["PMID"]["_"]: Cache function was worry about...
  • 11.02.2011: Version is outdated and not longer supported. Please update to version 2.

Version 2 - fcgi interface

  • 11 Feb 2011: Doing a complete redesign of the API. The SOAP-interface (used in Version 1) of Pubmed causes more problems than clouds in the sky. The redesigned extension uses the fcgi-interface and xml.
  • 11 Feb 2011B: Minor bugfix in proxy authentification (if user uses a proxy with login)
  • 07 Mar 2011: Minor bugfix: if Limit was set to 0 now it takes the max 500 (before it took 0) records.
  • 11 Apr 2011: Add CollectiveName to authorlist. E.g. see PubMed:18391952 and "Diabetes Genetics Initiative" and "Wellcome Trust Case Control Consortium" in authorlist.
  • 25.01.2012: Modification by Spencer Bliven in Date fild extraction.
  • 24.05.2017: Minor bug fixes that come with STRICT mode on Mac port.
  • 18 Jul 2018: changing http:// to https:// for outleading links
  • 31.10.2018: Fixing nested titles of the article - seems Pubmed can list more than one Title with [i]

Version 3 - json interface (experimental)

  • 18 Jul 2018: Version 3 connects to the json api and is smaller as version 2 that interfaces the xml api. At this time Pubmed offers a json api for esummery (and not efetch) only. The advantage of this version is that there is no dependency to xml.
  • You could test this version next to the other after installing by by changing wgPubmedPath to $wgPubmedPath="extensions/Pubmed3";

Bohne-Lang A, Groch WD, Ranzinger R
AISMIG--an interactive server-side molecule image generator.
Nucleic Acids Res: 2005 Jul 1, 33(Web Server issue);W705-9
[PubMed:15980568] [WorldCat.org ISSN ESSN][DOI] ( p)

  • For German users: Es gibt noch ein Einsprung mit der Issn und Essn zur ZDB - Dazu dieses definieren: layoutfile="layout_ext2.def" layoutlinks="PMID,ZDB,EZB_HD,DOI"

Bohne-Lang A, Groch WD, Ranzinger R
AISMIG--an interactive server-side molecule image generator.
Nucleic Acids Res: 2005 Jul 1, 33(Web Server issue);W705-9
[PubMed:15980568][ZDB ESSN ISSN] [EZB HD: ISSN ESSN][DOI]( p)

Usage examples[edit]

Most wikis are only used in Intranet but some are available from Internet:

See also[edit]



Bohne-Lang, Andreas and Lang, Elke
A landmark in biomedical information: many ways are leading to PubMed
Information und Wissen: global, sozial und frei? - Proceedings des 12. Internationalen Symposiums für Informationswissenschaft (ISI 2011); Hildesheim, 9.—11. March 2011 / hrsg. von Joachim Griesbaum, Thomas Mandl, Christa Womser-Hacker
Boizenburg : vwh, 2011, S. 496-7, (Schriften zur Informationswissenschaft; Bd. 58), ISBN: 978-3-940317-91-9
Conference poster (in english)


Andreas Bohne-Lang
Medical Faculty Mannheim of the University Heidelberg
Computational Center/Library
Ludolf-Krehl-Str. 13-17
68167 Mannheim
E-mail: andreas.bohne-lang@medma.uni-heidelberg.de