Git Product home page Git Product logo

php-pubmed-api-wrapper's Introduction

PHP PubMed API Wrapper

Author: Asif Rahman
Demo: Example

Description

A standalone PHP class provides a wrapper around the PubMed API. Fully documented with working examples.

  • Access PubMed through a proxy server programatically
  • Limit the total number of search results
  • Pagination splits search results amoung multiple pages
  • Optional exact search term matching
  • Cache search results as JSON formatted text files
  • Load search results from cache
  • Control lifetime of cache results

See the script in action at the Soterix Medical publications browser.

Documentation

To get started:

include('PubMedAPI.php');
$search_term = 'search query';
$PubMedAPI = new PubMedAPI();
$results = $PubMedAPI->query($search_term);

The query() method returns an array of search results or an empty array if no matches were found.

Interaction with the PubMed API is accomplished in two steps. Given a search term, the first query returns a list of PMIDs. The second query returns the metadata of each article. query() takes three arguments, the first is the search term string (this can also be the PMID if already known), the second is a boolean that returns a compact result if TRUE, and the third is an optional callback function to manipulate the results.

Returns the pmid, volume, issue, year, month, pages, issn, journal, journalabbrev, title, abstract, affiliation, authors, articleid, keywords of each article.

Refer to the class file for more documentation.

Copyright and License

This script is free software, available under the terms of the BSD-style open source license reproduced below, or, at your option, under the GNU General Public License version 2 or a later version.

PHP PubMed API Wrapper
Copyright © 2012 Asif Rahman
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name "PHP PubMedAPI Wrapper" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

php-pubmed-api-wrapper's People

Contributors

asifr avatar auehara avatar hwsamuel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-pubmed-api-wrapper's Issues

more specific search terms

hey there,

first of all thanks a lot for this great application! it works great in general and fits totally my needs (programming a webpage for a scientific institute). nonetheless i have a problem, you might be able to help me with.

every user has a profile and a search_term he/she can adjust to get the right list out of pubmed. some users have really common names, so the return is not really adequate. in medpub, one has the option to further specify the search terms, f.e. "Schmidt, Christina[Full Author Name] NOT Schmidt CM[Author]". can i do this with your api wrapper as well? i also tried the put the url version as $search_term, but it didnt work, f.e. "Schmidt%2C+Christina%5BFull+Author+Name%5D+NOT+Schmidt+CM%5BAuthor%5D".

thanks anyway and have nice day.

localhost index.php form is not working

I tried posting the search using Firefox browser but index.php throwun errors using localhost/index.php

do we need to setup DNS or proxy server .. please help .. i need this information to make it work

When I tried to run the program it didn't get any results

Hi Asif Rahman,

I was trying to use the code you developed to contact pubmed DB to extract some papers for further processing.

but I am having some problems:
I downloaded the folder and then extracted its content at my WAMP server root
it contains three files

PubMedAPI.php
index.php
README.md

I Opened "index.php" on my browser and then searched any term

the page just reloaded and got no results.

I would be very thankful if you advise me how to fix this and make the code work.

simplexml_load_string(): Entity: line 1: parser error : Space required after the Public Identifier

Hi,

The error come from the function PubMedAPI::load_xml_from_url.
I got this error regularly on my website that use your class, it's really good so thank you, but I can't seems to figure this error out. I suppose that it is returning this error when the pubmed api is returning a 404 or any other webpage and not XML, maybe when the website is down, but how can I prevent simplexml_load_string to not failed if it is not and XML.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.