diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 06cccce950752030e22f24bcd8de7a5c1b8cfaae..19b1c050b4d535315097cef3ef2068f1169d8788 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -559,17 +559,23 @@ $config = array( 'factories' => array( '360link' => function ($sm) { return new \VuFind\Resolver\Driver\Threesixtylink( - \VuFind\Config\Reader::getConfig()->OpenURL->url + \VuFind\Config\Reader::getConfig()->OpenURL->url, + $sm->getServiceLocator()->get('VuFind\Http') + ->createClient() ); }, 'ezb' => function ($sm) { return new \VuFind\Resolver\Driver\Ezb( - \VuFind\Config\Reader::getConfig()->OpenURL->url + \VuFind\Config\Reader::getConfig()->OpenURL->url, + $sm->getServiceLocator()->get('VuFind\Http') + ->createClient() ); }, 'sfx' => function ($sm) { return new \VuFind\Resolver\Driver\Sfx( - \VuFind\Config\Reader::getConfig()->OpenURL->url + \VuFind\Config\Reader::getConfig()->OpenURL->url, + $sm->getServiceLocator()->get('VuFind\Http') + ->createClient() ); }, ), diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php b/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php index 19e951bfbd3dc97349d6788b0605d39f5556dbc9..32ca36238c81fcf1ddb6899612aae3dab94302f9 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php @@ -51,14 +51,23 @@ class Ezb implements DriverInterface */ protected $baseUrl; + /** + * HTTP client + * + * @var \Zend\Http\Client + */ + protected $httpClient; + /** * Constructor * - * @param string $baseUrl Base URL for link resolver + * @param string $baseUrl Base URL for link resolver + * @param \Zend\Http\Client $client HTTP client */ - public function __construct($baseUrl) + public function __construct($baseUrl, \Zend\Http\Client $httpClient) { $this->baseUrl = $baseUrl; + $this->httpClient = $httpClient; } /** @@ -98,7 +107,7 @@ class Ezb implements DriverInterface // Make the call to the EZB and load results $url = $this->baseUrl . '?' . $openURL; - $feed = file_get_contents($url); + $feed = $this->httpClient->setUri($url)->send()->getBody(); return $feed; } diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php b/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php index 586a4da6c4707000aba15d44572d3552fad5b107..19c049503a60d86b2b08f88ea2d5be5ffde50188 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php @@ -48,14 +48,23 @@ class Sfx implements DriverInterface */ protected $baseUrl; + /** + * HTTP client + * + * @var \Zend\Http\Client + */ + protected $httpClient; + /** * Constructor * - * @param string $baseUrl Base URL for link resolver + * @param string $baseUrl Base URL for link resolver + * @param \Zend\Http\Client $client HTTP client */ - public function __construct($baseUrl) + public function __construct($baseUrl, \Zend\Http\Client $httpClient) { $this->baseUrl = $baseUrl; + $this->httpClient = $httpClient; } /** @@ -72,7 +81,7 @@ class Sfx implements DriverInterface // Make the call to SFX and load results $url = $this->baseUrl . '?sfx.response_type=multi_obj_detailed_xml&svc.fulltext=yes&' . $openURL; - $feed = file_get_contents($url); + $feed = $this->httpClient->setUri($url)->send()->getBody(); return $feed; } diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php b/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php index a2688bd9d3b2ed6af5a79315503d1bac1e242d6e..84c05e44d334fbdb4980b028a866001fc8a8be06 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php @@ -48,14 +48,23 @@ class Threesixtylink implements DriverInterface */ protected $baseUrl; + /** + * HTTP client + * + * @var \Zend\Http\Client + */ + protected $httpClient; + /** * Constructor * - * @param string $baseUrl Base URL for link resolver + * @param string $baseUrl Base URL for link resolver + * @param \Zend\Http\Client $client HTTP client */ - public function __construct($baseUrl) + public function __construct($baseUrl, \Zend\Http\Client $httpClient) { $this->baseUrl = $baseUrl; + $this->httpClient = $httpClient; } /** @@ -72,7 +81,7 @@ class Threesixtylink implements DriverInterface // Make the call to SerialsSolutions and load results $url = $this->baseUrl . (substr($this->baseUrl, -1) == '/' ? '' : '/') . 'openurlxml?version=1.0&' . $openURL; - $feed = file_get_contents($url); + $feed = $this->httpClient->setUri($url)->send()->getBody(); return $feed; }