Esempio n. 1
0
 private function init()
 {
     if ($this->ready) {
         return;
     }
     $this->ready = true;
     $settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password);
     $this->client = new Client($settings);
     $this->client->setThrowExceptions(true);
     if ($this->secure === true && $this->certPath) {
         $this->client->addTrustedCertificates($this->certPath);
     }
 }
Esempio n. 2
0
 private function init()
 {
     if ($this->ready) {
         return;
     }
     $this->ready = true;
     $settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password);
     $proxy = \OC::$server->getConfig()->getSystemValue('proxy', '');
     if ($proxy !== '') {
         $settings['proxy'] = $proxy;
     }
     $this->client = new Client($settings);
     $this->client->setThrowExceptions(true);
     if ($this->secure === true && $this->certPath) {
         $this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath);
     }
 }
Esempio n. 3
0
 /**
  * @param string $url
  * @param string $sharedSecret
  * @param string $resourcePath
  * @return array
  */
 protected function download($url, $sharedSecret, $resourcePath)
 {
     $settings = ['baseUri' => $url, 'userName' => 'system', 'password' => $sharedSecret];
     $client = new Client($settings);
     $client->setThrowExceptions(true);
     $response = $client->request('GET', $resourcePath);
     return $response;
 }