Loading module/Import/config/module.config.php +1 −8 Changes for module/Import/config/module.config.php: 1 added line, 8 removed lines. Original line number Diff line number Diff line <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ use Zend\Mvc\Router\Http\Literal; use Zend\Mvc\Router\Http\Segment; Loading Loading @@ -90,7 +83,7 @@ return array( 'routes' => [ 'home-import' => [ 'type' => 'Literal', 'may_terminate' => true, 'may_terminate' => false, 'options' => [ 'route' => '/fetch', 'defaults' => [ Loading module/Import/src/Import/Service/FetcherService.php +20 −3 Changes for module/Import/src/Import/Service/FetcherService.php: 20 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ class FetcherService protected $user; protected $password; /** * @var boolean|string */ protected $verify; /** * Constructor ... * @param EntityManager $entityManager Loading @@ -57,6 +62,10 @@ class FetcherService $this->password = $config['users']['password']; $this->url = $config['import-api']['etablissements'][0]['url']; $this->code = $config['import-api']['etablissements'][0]['code']; if (isset($config['import-api']['etablissements'][0]['verify'])) { $this->verify = $config['import-api']['etablissements'][0]['verify']; } } /** Loading Loading @@ -113,24 +122,32 @@ class FetcherService } /** Fonction chargée d'optenir la réponse d'un Web Service * * @param string $uri : la "page" du Web Service à interroger * @return Response la réponse du Web Service * * RMQ le client est configuré en utilisant les propriétés du FetcherService * * TODO mettre automatique le proxy * @throws \Exception */ public function getResponse($uri) { try { $client = new Client([ $options = [ 'base_uri' => $this->url, 'headers' => [ 'Accept' => 'application/json', ], 'proxy' => ['no' => 'localhost'], 'auth' => [$this->user, $this->password], ]); ]; if ($this->verify !== null) { $options['verify'] = $this->verify; } try { $client = new Client($options); $response = $client->request('GET', $uri); } catch (\Exception $e) { $response = new Response(); Loading Loading
module/Import/config/module.config.php +1 −8 Changes for module/Import/config/module.config.php: 1 added line, 8 removed lines. Original line number Diff line number Diff line <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ use Zend\Mvc\Router\Http\Literal; use Zend\Mvc\Router\Http\Segment; Loading Loading @@ -90,7 +83,7 @@ return array( 'routes' => [ 'home-import' => [ 'type' => 'Literal', 'may_terminate' => true, 'may_terminate' => false, 'options' => [ 'route' => '/fetch', 'defaults' => [ Loading
module/Import/src/Import/Service/FetcherService.php +20 −3 Changes for module/Import/src/Import/Service/FetcherService.php: 20 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ class FetcherService protected $user; protected $password; /** * @var boolean|string */ protected $verify; /** * Constructor ... * @param EntityManager $entityManager Loading @@ -57,6 +62,10 @@ class FetcherService $this->password = $config['users']['password']; $this->url = $config['import-api']['etablissements'][0]['url']; $this->code = $config['import-api']['etablissements'][0]['code']; if (isset($config['import-api']['etablissements'][0]['verify'])) { $this->verify = $config['import-api']['etablissements'][0]['verify']; } } /** Loading Loading @@ -113,24 +122,32 @@ class FetcherService } /** Fonction chargée d'optenir la réponse d'un Web Service * * @param string $uri : la "page" du Web Service à interroger * @return Response la réponse du Web Service * * RMQ le client est configuré en utilisant les propriétés du FetcherService * * TODO mettre automatique le proxy * @throws \Exception */ public function getResponse($uri) { try { $client = new Client([ $options = [ 'base_uri' => $this->url, 'headers' => [ 'Accept' => 'application/json', ], 'proxy' => ['no' => 'localhost'], 'auth' => [$this->user, $this->password], ]); ]; if ($this->verify !== null) { $options['verify'] = $this->verify; } try { $client = new Client($options); $response = $client->request('GET', $uri); } catch (\Exception $e) { $response = new Response(); Loading