Beispiel #1
0
 protected function httpStat($url)
 {
     $result = array();
     try {
         $sendRequest = HttpRequest::create()->setMethod(HttpMethod::get())->setUrl(HttpUrl::create()->parse($url));
         $res = CurlHttpClient::create()->setOption(CURLOPT_RETURNTRANSFER, true)->setOption(CURLOPT_NOBODY, true)->send($sendRequest);
         $result['mime'] = $res->getHeader('content-type');
         $result['size'] = $res->getHeader('content-length');
     } catch (Exception $e) {
     }
     return $result;
 }
 protected function loadXRDS($url)
 {
     $response = $this->httpClient->send(HttpRequest::create()->setHeaderVar('Accept', self::HEADER_ACCEPT)->setMethod(HttpMethod::get())->setUrl(HttpUrl::create()->parse($url)));
     if ($response->getStatus()->getId() != 200) {
         throw new OpenIdException('can\'t fetch document');
     }
     $this->parseXRDS($response->getBody());
     return $this;
 }