|
|
@ -1,6 +1,5 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* EBSCO API class |
|
|
|
* EBSCO API class |
|
|
|
* |
|
|
|
* |
|
|
@ -8,19 +7,17 @@ |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* EBSCO API class |
|
|
|
* EBSCO API class |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class EBSCOAPI |
|
|
|
class EBSCOAPI { |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The authentication token used for API transactions |
|
|
|
* The authentication token used for API transactions |
|
|
|
* @global string |
|
|
|
* @global string |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private $authenticationToken; |
|
|
|
private $authenticationToken; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The session token for API transactions |
|
|
|
* The session token for API transactions |
|
|
|
* @global string |
|
|
|
* @global string |
|
|
@ -32,7 +29,6 @@ class EBSCOAPI |
|
|
|
* @global object EBSCOConnector |
|
|
|
* @global object EBSCOConnector |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private $connector; |
|
|
|
private $connector; |
|
|
|
|
|
|
|
|
|
|
|
private $config; |
|
|
|
private $config; |
|
|
|
|
|
|
|
|
|
|
|
public function __construct($config) { |
|
|
|
public function __construct($config) { |
|
|
@ -48,8 +44,7 @@ class EBSCOAPI |
|
|
|
* @return EBSCOConnector object |
|
|
|
* @return EBSCOConnector object |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function connector($config) |
|
|
|
public function connector($config) { |
|
|
|
{ |
|
|
|
|
|
|
|
if (empty($this->connector)) { |
|
|
|
if (empty($this->connector)) { |
|
|
|
$this->connector = new EBSCOConnector($config); |
|
|
|
$this->connector = new EBSCOConnector($config); |
|
|
|
} |
|
|
|
} |
|
|
@ -57,7 +52,6 @@ class EBSCOAPI |
|
|
|
return $this->connector; |
|
|
|
return $this->connector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new EBSCOResponse object |
|
|
|
* Create a new EBSCOResponse object |
|
|
|
* |
|
|
|
* |
|
|
@ -66,13 +60,11 @@ class EBSCOAPI |
|
|
|
* @return EBSCOResponse object |
|
|
|
* @return EBSCOResponse object |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function response($response) |
|
|
|
public function response($response) { |
|
|
|
{ |
|
|
|
|
|
|
|
$responseObj = new EBSCOResponse($response); |
|
|
|
$responseObj = new EBSCOResponse($response); |
|
|
|
return $responseObj; |
|
|
|
return $responseObj; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Request authentication and session tokens, then send the API request. |
|
|
|
* Request authentication and session tokens, then send the API request. |
|
|
|
* Retry the request if authentication errors occur |
|
|
|
* Retry the request if authentication errors occur |
|
|
@ -85,19 +77,18 @@ class EBSCOAPI |
|
|
|
* @return array An associative array with results. |
|
|
|
* @return array An associative array with results. |
|
|
|
* @access protected |
|
|
|
* @access protected |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected function request($action, $params = null, $attempts = 3) |
|
|
|
protected function request($action, $params = null, $attempts = 3) { |
|
|
|
{ |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
$authenticationToken = $this->getAuthToken(); |
|
|
|
$authenticationToken = $this->getAuthToken(); |
|
|
|
$sessionToken = $this->getSessionToken($authenticationToken); |
|
|
|
$sessionToken = $this->getSessionToken($authenticationToken); |
|
|
|
|
|
|
|
|
|
|
|
if(empty($authenticationToken)){ |
|
|
|
if (empty($authenticationToken)) { |
|
|
|
$authenticationToken = $this -> getAuthToken(); |
|
|
|
$authenticationToken = $this->getAuthToken(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(empty($sessionToken)){ |
|
|
|
if (empty($sessionToken)) { |
|
|
|
$sessionToken = $this -> getSessionToken($authenticationToken,'y'); |
|
|
|
$sessionToken = $this->getSessionToken($authenticationToken, 'y'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$headers = array( |
|
|
|
$headers = array( |
|
|
@ -109,14 +100,14 @@ class EBSCOAPI |
|
|
|
$result = $this->response($response)->result(); |
|
|
|
$result = $this->response($response)->result(); |
|
|
|
$results = $result; |
|
|
|
$results = $result; |
|
|
|
return $results; |
|
|
|
return $results; |
|
|
|
} catch(EBSCOException $e) { |
|
|
|
} catch (EBSCOException $e) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
// Retry the request if there were authentication errors |
|
|
|
// Retry the request if there were authentication errors |
|
|
|
$code = $e->getCode(); |
|
|
|
$code = $e->getCode(); |
|
|
|
switch ($code) { |
|
|
|
switch ($code) { |
|
|
|
case EBSCOConnector::EDS_AUTH_TOKEN_INVALID: |
|
|
|
case EBSCOConnector::EDS_AUTH_TOKEN_INVALID: |
|
|
|
$authenticationToken = $this->getAuthToken(); |
|
|
|
$authenticationToken = $this->getAuthToken(); |
|
|
|
$sessionToken = $this ->getSessionToken($authenticationToken); |
|
|
|
$sessionToken = $this->getSessionToken($authenticationToken); |
|
|
|
$headers = array( |
|
|
|
$headers = array( |
|
|
|
'x-authenticationToken: ' . $authenticationToken, |
|
|
|
'x-authenticationToken: ' . $authenticationToken, |
|
|
|
'x-sessionToken: ' . $sessionToken |
|
|
|
'x-sessionToken: ' . $sessionToken |
|
|
@ -126,7 +117,7 @@ class EBSCOAPI |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case EBSCOConnector::EDS_SESSION_TOKEN_INVALID: |
|
|
|
case EBSCOConnector::EDS_SESSION_TOKEN_INVALID: |
|
|
|
$sessionToken = $this ->getSessionToken($authenticationToken,'y'); |
|
|
|
$sessionToken = $this->getSessionToken($authenticationToken, 'y'); |
|
|
|
$headers = array( |
|
|
|
$headers = array( |
|
|
|
'x-authenticationToken: ' . $authenticationToken, |
|
|
|
'x-authenticationToken: ' . $authenticationToken, |
|
|
|
'x-sessionToken: ' . $sessionToken |
|
|
|
'x-sessionToken: ' . $sessionToken |
|
|
@ -142,13 +133,13 @@ class EBSCOAPI |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch(Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
$result = array( |
|
|
|
$result = array( |
|
|
|
'error' => $e->getMessage() |
|
|
|
'error' => $e->getMessage() |
|
|
|
); |
|
|
|
); |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch(Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
$result = array( |
|
|
|
$result = array( |
|
|
|
'error' => $e->getMessage() |
|
|
|
'error' => $e->getMessage() |
|
|
|
); |
|
|
|
); |
|
|
@ -156,16 +147,22 @@ class EBSCOAPI |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function writeLockFile(){ |
|
|
|
private function writeTokenFile() { |
|
|
|
$tokenFile = fopen("edstoken.txt","w+"); |
|
|
|
$tokenFile = fopen("edstoken.txt", "w+"); |
|
|
|
$result = $this->apiAuthenticationToken(); |
|
|
|
$result = $this->apiAuthenticationToken(); |
|
|
|
fwrite($tokenFile, $result['authenticationToken']."\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationToken'] . "\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeout']."\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeout'] . "\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeStamp']); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeStamp']); |
|
|
|
fclose($tokenFile); |
|
|
|
fclose($tokenFile); |
|
|
|
return $result['authenticationToken']; |
|
|
|
return $result['authenticationToken']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function writeLockFile() { |
|
|
|
|
|
|
|
$lockFile = fopen("edslock.txt", "w+"); |
|
|
|
|
|
|
|
fwrite($lockFile, 'lock'); |
|
|
|
|
|
|
|
fclose($lockFile); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Get authentication token from appication scop |
|
|
|
* Get authentication token from appication scop |
|
|
|
* Check authToen's expiration |
|
|
|
* Check authToen's expiration |
|
|
@ -175,32 +172,40 @@ class EBSCOAPI |
|
|
|
* |
|
|
|
* |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getAuthToken(){ |
|
|
|
|
|
|
|
$lockFile = fopen("edslock.txt","r"); |
|
|
|
public function getAuthToken() { |
|
|
|
$tokenFile =fopen("edstoken.txt","r"); |
|
|
|
$lockFile = fopen("edslock.txt", "r"); |
|
|
|
if(empty($lockFile) || empty($tokenFile)){ |
|
|
|
if (empty($lockFile)) { |
|
|
|
return $this->writeLockFile(); |
|
|
|
$this->writeLockFile(); |
|
|
|
} |
|
|
|
$lockFile = fopen("edslock.txt", "r"); |
|
|
|
while(!feof($tokenFile)){ |
|
|
|
} |
|
|
|
$authToken = rtrim(fgets($tokenFile),"\n"); |
|
|
|
$tokenFile = fopen("edstoken.txt", "r"); |
|
|
|
$timeout = fgets($tokenFile)-600; |
|
|
|
if (empty($tokenFile)) { |
|
|
|
|
|
|
|
$this->writetokenFile(); |
|
|
|
|
|
|
|
$tokenFile = fopen("edstoken.txt", "r"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
while (!feof($tokenFile)) { |
|
|
|
|
|
|
|
$authToken = rtrim(fgets($tokenFile), "\n"); |
|
|
|
|
|
|
|
$timeout = fgets($tokenFile) - 600; |
|
|
|
$timestamp = fgets($tokenFile); |
|
|
|
$timestamp = fgets($tokenFile); |
|
|
|
} |
|
|
|
} |
|
|
|
fclose($tokenFile); |
|
|
|
fclose($tokenFile); |
|
|
|
if(time()-$timestamp>=$timeout){ |
|
|
|
if (time() - $timestamp >= $timeout) { |
|
|
|
// Lock check. |
|
|
|
// Lock check. |
|
|
|
if(flock($lockFile, LOCK_EX)){ |
|
|
|
if (flock($lockFile, LOCK_EX)) { |
|
|
|
$tokenFile = fopen("edstoken.txt","w+"); |
|
|
|
$tokenFile = fopen("edstoken.txt", "w+"); |
|
|
|
$result = $this->apiAuthenticationToken(); |
|
|
|
$result = $this->apiAuthenticationToken(); |
|
|
|
fwrite($tokenFile, $result['authenticationToken']."\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationToken'] . "\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeout']."\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeout'] . "\n"); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeStamp']); |
|
|
|
fwrite($tokenFile, $result['authenticationTimeStamp']); |
|
|
|
fclose($tokenFile); |
|
|
|
fclose($tokenFile); |
|
|
|
return $result['authenticationToken']; |
|
|
|
return $result['authenticationToken']; |
|
|
|
}else{ |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
return $authToken; |
|
|
|
return $authToken; |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
return $authToken; |
|
|
|
return $authToken; |
|
|
|
} |
|
|
|
} |
|
|
|
fclose($lockFile); |
|
|
|
fclose($lockFile); |
|
|
@ -213,8 +218,7 @@ class EBSCOAPI |
|
|
|
* |
|
|
|
* |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function apiAuthenticationToken() |
|
|
|
public function apiAuthenticationToken() { |
|
|
|
{ |
|
|
|
|
|
|
|
$response = $this->connector->requestAuthenticationToken(); |
|
|
|
$response = $this->connector->requestAuthenticationToken(); |
|
|
|
$result = $this->response($response)->result(); |
|
|
|
$result = $this->response($response)->result(); |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
@ -228,42 +232,37 @@ class EBSCOAPI |
|
|
|
* @param Authentication token, Profile |
|
|
|
* @param Authentication token, Profile |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getSessionToken($authenToken, $invalid='n'){ |
|
|
|
public function getSessionToken($authenToken, $invalid = 'n') { |
|
|
|
$token = ''; |
|
|
|
$token = ''; |
|
|
|
|
|
|
|
|
|
|
|
// Check user's login status |
|
|
|
// Check user's login status |
|
|
|
if(isset($_COOKIE['login'])){ |
|
|
|
/* if(isset($_COOKIE['login'])){ |
|
|
|
if($invalid=='y'){ |
|
|
|
if($invalid=='y'){ |
|
|
|
$profile = $_SESSION['sessionToken']['profile']; |
|
|
|
$profile = $_SESSION['sessionToken']['profile']; |
|
|
|
$sessionToken = $this->apiSessionToken($authenToken, $profile,'n'); |
|
|
|
$sessionToken = $this->apiSessionToken($authenToken, $profile,'n'); |
|
|
|
$_SESSION['sessionToken']=$sessionToken; |
|
|
|
$_SESSION['sessionToken']=$sessionToken; |
|
|
|
} |
|
|
|
} |
|
|
|
$token = $_SESSION['sessionToken']['sessionToken']; |
|
|
|
$token = $_SESSION['sessionToken']['sessionToken']; |
|
|
|
} |
|
|
|
} */ |
|
|
|
else if(isset($_COOKIE['Guest'])){ |
|
|
|
//else |
|
|
|
if($invalid=='y'){ |
|
|
|
if (isset($_COOKIE['Guest'])) { |
|
|
|
|
|
|
|
if ($invalid == 'y') { |
|
|
|
$profile = $_SESSION['sessionToken']['profile']; |
|
|
|
$profile = $_SESSION['sessionToken']['profile']; |
|
|
|
$sessionToken = $this->apiSessionToken($authenToken, $profile,'y'); |
|
|
|
if (empty($profile)) { |
|
|
|
$_SESSION['sessionToken']=$sessionToken; |
|
|
|
$profile = $_COOKIE['Guest']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$sessionToken = $this->apiSessionToken($authenToken, $profile, 'y'); |
|
|
|
|
|
|
|
$_SESSION['sessionToken'] = $sessionToken; |
|
|
|
} |
|
|
|
} |
|
|
|
$token = $_SESSION['sessionToken']['sessionToken']; |
|
|
|
$token = $_SESSION['sessionToken']['sessionToken']; |
|
|
|
}else{ |
|
|
|
} |
|
|
|
//$xml ="Config.xml"; |
|
|
|
else { |
|
|
|
//$dom = new DOMDocument(); |
|
|
|
|
|
|
|
//$dom->load($xml); |
|
|
|
|
|
|
|
//$EDSCredentials = $dom ->getElementsByTagName('EDSCredentials')->item(0); |
|
|
|
|
|
|
|
//$users = $EDSCredentials -> getElementsByTagName('User'); |
|
|
|
|
|
|
|
$profileId = $this->config['profile']; |
|
|
|
$profileId = $this->config['profile']; |
|
|
|
//foreach($users as $user){ |
|
|
|
|
|
|
|
// $userType = $user->getElementsByTagName('ClientUser')->item(0)->nodeValue; |
|
|
|
$sessionToken = $this->apiSessionToken($authenToken, $profileId, 'y'); |
|
|
|
// if($userType == 'guest'){ |
|
|
|
|
|
|
|
// $profileId = $user -> getElementsByTagName('EDSProfile')->item(0)->nodeValue; |
|
|
|
|
|
|
|
// break; |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
$sessionToken = $this->apiSessionToken($authenToken, $profileId,'y'); |
|
|
|
|
|
|
|
$_SESSION['profile'] = $profileId; |
|
|
|
$_SESSION['profile'] = $profileId; |
|
|
|
$_SESSION['sessionToken']=$sessionToken; |
|
|
|
$_SESSION['sessionToken'] = $sessionToken; |
|
|
|
setcookie("Guest", $profileId, 0); |
|
|
|
setcookie("Guest", $profileId, 0); |
|
|
|
$token = $sessionToken['sessionToken']; |
|
|
|
$token = $sessionToken['sessionToken']; |
|
|
|
} |
|
|
|
} |
|
|
@ -277,17 +276,16 @@ class EBSCOAPI |
|
|
|
* |
|
|
|
* |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function apiSessionToken($authenToken, $profile, $guest) |
|
|
|
public function apiSessionToken($authenToken, $profile, $guest) { |
|
|
|
{ |
|
|
|
|
|
|
|
// Add authentication tokens to headers |
|
|
|
// Add authentication tokens to headers |
|
|
|
$headers = array( |
|
|
|
$headers = array( |
|
|
|
'x-authenticationToken: ' . $authenToken |
|
|
|
'x-authenticationToken: ' . $authenToken |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$response = $this->connector($this->config)->requestSessionToken($headers, $profile,$guest); |
|
|
|
$response = $this->connector($this->config)->requestSessionToken($headers, $profile, $guest); |
|
|
|
$result = $this->response($response)->result(); |
|
|
|
$result = $this->response($response)->result(); |
|
|
|
$token = array( |
|
|
|
$token = array( |
|
|
|
'sessionToken'=>$result, |
|
|
|
'sessionToken' => $result, |
|
|
|
'profile' => $profile |
|
|
|
'profile' => $profile |
|
|
|
); |
|
|
|
); |
|
|
|
return $token; |
|
|
|
return $token; |
|
|
@ -300,14 +298,14 @@ class EBSCOAPI |
|
|
|
* |
|
|
|
* |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function apiEndSessionToken($authenToken, $sessionToken){ |
|
|
|
public function apiEndSessionToken($authenToken, $sessionToken) { |
|
|
|
|
|
|
|
|
|
|
|
// Add authentication tokens to headers |
|
|
|
// Add authentication tokens to headers |
|
|
|
$headers = array( |
|
|
|
$headers = array( |
|
|
|
'x-authenticationToken: '.$authenToken |
|
|
|
'x-authenticationToken: ' . $authenToken |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$this -> connector($this->config)->requestEndSessionToken($headers, $sessionToken); |
|
|
|
$this->connector($this->config)->requestEndSessionToken($headers, $sessionToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -325,7 +323,6 @@ class EBSCOAPI |
|
|
|
return $results; |
|
|
|
return $results; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Wrapper for retrieve API call |
|
|
|
* Wrapper for retrieve API call |
|
|
|
* |
|
|
|
* |
|
|
@ -336,8 +333,7 @@ class EBSCOAPI |
|
|
|
* @return array An associative array of data |
|
|
|
* @return array An associative array of data |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function apiRetrieve($an, $db, $term) |
|
|
|
public function apiRetrieve($an, $db, $term) { |
|
|
|
{ |
|
|
|
|
|
|
|
// Add the HTTP query params |
|
|
|
// Add the HTTP query params |
|
|
|
$params = array( |
|
|
|
$params = array( |
|
|
|
'an' => $an, |
|
|
|
'an' => $an, |
|
|
@ -349,27 +345,27 @@ class EBSCOAPI |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Wrapper for info API call |
|
|
|
* Wrapper for info API call |
|
|
|
* |
|
|
|
* |
|
|
|
* @return array An associative array of data |
|
|
|
* @return array An associative array of data |
|
|
|
* @access public |
|
|
|
* @access public |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getInfo() |
|
|
|
public function getInfo() { |
|
|
|
{ |
|
|
|
if (isset($_SESSION['info'])) { |
|
|
|
if(isset($_SESSION['info'])){ |
|
|
|
|
|
|
|
$InfoArray = $_SESSION['info']; |
|
|
|
$InfoArray = $_SESSION['info']; |
|
|
|
$timestamp = $InfoArray['timestamp']; |
|
|
|
$timestamp = $InfoArray['timestamp']; |
|
|
|
if(time()-$timestamp>=3600){ |
|
|
|
if (time() - $timestamp >= 3600) { |
|
|
|
// Get new Info for the profile |
|
|
|
// Get new Info for the profile |
|
|
|
$InfoArray = $this->apiInfo(); |
|
|
|
$InfoArray = $this->apiInfo(); |
|
|
|
$_SESSION['info'] = $InfoArray; |
|
|
|
$_SESSION['info'] = $InfoArray; |
|
|
|
$info = $InfoArray['Info']; |
|
|
|
$info = $InfoArray['Info']; |
|
|
|
}else{ |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
$info = $InfoArray['Info']; |
|
|
|
$info = $InfoArray['Info']; |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
// Get new Info for the profile |
|
|
|
// Get new Info for the profile |
|
|
|
$InfoArray = $this->apiInfo(); |
|
|
|
$InfoArray = $this->apiInfo(); |
|
|
|
$_SESSION['info'] = $InfoArray; |
|
|
|
$_SESSION['info'] = $InfoArray; |
|
|
@ -378,14 +374,16 @@ class EBSCOAPI |
|
|
|
return $info; |
|
|
|
return $info; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function apiInfo(){ |
|
|
|
public function apiInfo() { |
|
|
|
|
|
|
|
|
|
|
|
$response = $this->request('Info',''); |
|
|
|
$response = $this->request('Info', ''); |
|
|
|
$Info = array( |
|
|
|
$Info = array( |
|
|
|
'Info' => $response, |
|
|
|
'Info' => $response, |
|
|
|
'timestamp'=>time() |
|
|
|
'timestamp' => time() |
|
|
|
); |
|
|
|
); |
|
|
|
return $Info; |
|
|
|
return $Info; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
|
?> |