#!/usr/bin/perl -w use strict; use warnings; use CGI; use OAuth::Lite::Consumer; use OAuth::Lite::AuthMethod; #my $access_key = 'PUBLIC_OAUTH_CONSUMER_KEY'; #my $secret_key = 'PUBLIC_OAUTH_CONSUMER_SECRET'; my $access_key = '7e6ee38bae'; # PUBLIC_OAUTH_CONSUMER_KEY my $secret_key = 'e0429c0394385486249b4a230702'; # PUBLIC_OAUTH_CONSUMER_SECRET #my $request_url = 'http://babel.hathitrust.org/cgi/htd/dapiserver'; #my $request_url = "http://babel.hathitrust.org/cgi/htd/meta/mdp.39015019203879"; my $request_url = "http://babel.hathitrust.org/cgi/htd/pagemeta/mdp.39015000000128/12"; my $consumer = OAuth::Lite::Consumer->new( 'consumer_key' => $access_key, 'consumer_secret' => $secret_key, 'auth_method' => OAuth::Lite::AuthMethod::URL_QUERY ); my $response = $consumer->request( 'method' => 'GET', 'url' => $request_url, # 'params' => { 'hello' => 'world' } ); print CGI::header(); print "

[CLIENT] sent this URL to server:
"; print $consumer->oauth_request->uri; print "

[CLIENT] received this HTTP response from server:
"; print $response->status_line; if ($response->is_success) { print "
[CLIENT] received this content response from server:

" . $response->content . "
"; } print STDERR "*****\n ", $consumer->oauth_request->uri, "\n"; exit 0;