EPrints Technical Mailing List Archive

Message: #05727


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Thomson Reuters API/PHP


Hi Andrew,

I got this working a few yesrs ago in Perl cgi, with a PHP wrapper to fetch the records 50 at a time from our DB, and write the results back to the DB.  I won’t post it all here, but the core of it is below, and I can send you the rest privately if you want, to spare myself the embarrassment of exposing my quick-and-dirty code to ridicule.

 

This is the core of it, fetchLAMR function, that takes any of UT, PMID, or DOI, and returns the XML from the Web service.  You’ll need to change the email address and app-id string in the src parameter of the XML, obviously. 

 

 

 

Hope it helps

 

Andy

 

 

Andy Reid

Research Information Manager

Executive Office, Room G43

London School of Hygiene and Tropical Medicine

Keppel St, LONDON, WC1E 7HT

0207-927-2618 (Internal x2618)

 

 

 

 

USAGE:    http://myserver.ac.uk/cgi-bin/testLAMR.pl?DOI=10.1234/123abc789xyz   (and/or &PMID=    and/or &UT =)

 

==========================

testLAMR.pl

#######################################################################################

#  MAIN

#######################################################################################

use CGI;

use CGI::Carp qw(fatalsToBrowser);

use LAMR;                                                            ########### LAMR.pm perl module below ############

 

my $query=new CGI;

 

########################### takes any or all of the following in the query string

$UT = $query->param('UT');

$PMID= $query->param('PMID');

$DOI= $query->param('DOI');

 

 

############$backref=$query->param('back');  ### used by wrapper to redirect back to calling page

 

######## OUTPUT ######################

print $query->header('text/xml');

#print $query->start_html("LAMR citation details");

 

$XML .= &fetch_LAMR($UT,$PMID,$DOI);

 

{

$XML =~ m{<val name=\"timesCited\">(\d*)<\/val>};          ### find the bit of the response that you want by crude Regexp

print “$DOI  :times cited= “. $timesCited=$1;

}

 

### ##################################################################################################################################

 

==========================

LAMR.pm

==========================

package LAMR;

require Exporter;

 

our @ISA= qw(Exporter);

our @EXPORT = qw(fetch_LAMR);

our @EXPORT_OK=qw();

our $VERSION = 1.00;

 

 

sub fetch_LAMR{

    my ($UT,$PMID,$DOI) =  @_;

use LWP::UserAgent;

use HTTP::Request::Common;

 

my $ua = new LWP::UserAgent;

 

 

################################################################################################

##################  XML CONTENT ####################################################################

###############################################################################################

 

$XMLrequest =

qq#<?xml version="1.0" encoding="UTF-8" ?>

<request xmlns="http://www.isinet.com/xrpc41"

src="" >

 

  <fn name="LinksAMR.retrieve">

    <list>

<!-- WHO'S REQUESTING -->

      <map>

      </map>

<!-- WHAT'S REQUESTED -->

      <map>

        <list name="WOS">

          <val>timesCited</val>

           <val>ut</val>

                  <val>pmid</val>

          <val>doi</val>

          <val>sourceURL</val>

          <val>citingArticlesURL</val>

          <val>relatedRecordsURL</val> 

         </list>

      </map> <!--end "return_data" -->

<!-- LOOKUP DATA -->

      <map>

<!-- QUERY "cite_id1" -->

        <map name="cite_id">

          <val name="ut">$UT</val>         

                  <val name="pmid">$PMID</val>         

                  <val name="doi">$DOI</val>         

       </map> <!-- end of cite_id-->

 

      </map> <!-- end of citations -->

    </list>

  </fn>

</request>

#;

 

####################################################################################

####################################################################################

 

my $response =$ua->request(POST 'http://ws.isiknowledge.com/cps/xrpc',

Content_Type => 'text/html',

Content => $XMLrequest);

my $content = $response->content;

 

#   $content =~ m/<val name=\"pmid\">(\d*)<\/val>/;

#return $1;

 

 

#    return grep( /pmid|ut|doi|message/, split(/^/,$content));

    return $content;

}

 

 

1;

 

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Andrew Beeken
Sent: 23 May 2016 10:10
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Thomson Reuters API/PHP

 

Hi all,

 

Don’t know if this is the ideal forum for this but I’ve been banging my head against a brick wall for the last week trying to get this working. We have access to the full Thomson Reuters WoS Web Services API through our InCites subscription and I’m trying to build a PHP script to dive in and grab citation counts for records based on DOI. I’m struggling a bit, however; the API uses SOAP which I’m really not familiar with and trying to use the (somewhat confusing) TR documentation to hack things together, extrapolating from online examples, is leading to multiple dead ends with tech support from TR being unable to provide any language specific assistance. Has anyone successfully integrated this through PHP or have any experience using SOAP that could give me a few pointers?

 

Talk soon!

Andrew Beeken

Research Information Systems Developer

University of Lincoln

 


The University of Lincoln, located in the heart of the city of Lincoln, has established an international reputation based on high student satisfaction, excellent graduate employment and world-class research.


The information in this e-mail and any attachments may be confidential. If you have received this email in error please notify the sender immediately and remove it from your system. Do not disclose the contents to another person or take copies.

Email is not secure and may contain viruses. The University of Lincoln makes every effort to ensure email is sent without viruses, but cannot guarantee this and recommends recipients take appropriate precautions.

The University may monitor email traffic data and content in accordance with its policies and English law. Further information can be found at: http://lincoln.ac.uk/legal.