コード例 #1
0
ファイル: CookieJar.php プロジェクト: lamenath/fbp
 /**
  * {@inheritdoc}
  */
 public function extract(InternalRequestInterface $request, ResponseInterface $response)
 {
     foreach ($response->getHeaderAsArray('Set-Cookie') as $header) {
         $cookie = $this->cookieFactory->parse($header);
         if (!$cookie->hasAttribute(CookieInterface::ATTR_DOMAIN)) {
             $cookie->setAttribute(CookieInterface::ATTR_DOMAIN, parse_url((string) $request->getUrl(), PHP_URL_HOST));
         }
         $this->addCookie($cookie);
     }
 }
コード例 #2
0
ファイル: CookieJar.php プロジェクト: czifumasa/Inzynierka6
 /**
  * {@inheritdoc}
  */
 public function extract(InternalRequestInterface $request, ResponseInterface $response)
 {
     foreach ($response->getHeader('Set-Cookie') as $header) {
         $cookie = $this->cookieFactory->parse($header);
         if (!$cookie->hasAttribute(CookieInterface::ATTR_DOMAIN)) {
             $cookie->setAttribute(CookieInterface::ATTR_DOMAIN, $request->getUri()->getHost());
         }
         $this->addCookie($cookie);
     }
 }