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); } }
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); } }
/** * @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; }