protected function getDaxkoPageSource($url) {
    $config = $this->configFactory->get('openy_programs_search.settings');

    // @todo Add try/catch.
    $options = ['allow_redirects' => FALSE];
    $res = $this->http->request('GET', $url, $options);
    $cookies = $res->getHeader('Set-Cookie');

    $final = [];
    $domain = '.' . $config->get('domain');
    foreach ($cookies as $cookie) {
      $parts = explode(';', $cookie);
      foreach ($parts as $part) {
        $parts2 = explode('=', $part);
        if (!empty($parts2[1])) {
          $final[trim($parts2[0])] = trim($parts2[1]);
          if (strtolower($parts2[0]) == 'domain') {
            $domain = $parts2[1];
          }
        }
      }
    }

    $jar = new CookieJar();
    foreach ($final as $key => $value) {
      if (strtolower($key) != 'domain') {
        $setcookie = new SetCookie();
        $setcookie->setName($key);
        $setcookie->setValue($value);
        $setcookie->setDomain($domain);
        $jar->setCookie($setcookie);
      }
    }

    // @todo Add try/catch.
    $options = ['allow_redirects' => FALSE, 'cookies' => $jar];
    $res2 = $this->http->request('GET', $url, $options);
    $contents = $res2->getBody()->getContents();

    return $contents;
  }
protected function getDaxkoPageSource($url) {
    $config = $this->configFactory->get('openy_programs_search.settings');

    // @todo Add try/catch.
    $options = ['allow_redirects' => FALSE];
    $res = $this->http->request('GET', $url, $options);
    $cookies = $res->getHeader('Set-Cookie');

    $final = [];
    $domain = '.' . $config->get('domain');
    foreach ($cookies as $cookie) {
      $parts = explode(';', $cookie);
      foreach ($parts as $part) {
        $parts2 = explode('=', $part);
        if (!empty($parts2[1])) {
          $final[trim($parts2[0])] = trim($parts2[1]);
          if (strtolower($parts2[0]) == 'domain') {
            $domain = $parts2[1];
          }
        }
      }
    }

    $jar = new CookieJar();
    foreach ($final as $key => $value) {
      if (strtolower($key) != 'domain') {
        $setcookie = new SetCookie();
        $setcookie->setName($key);
        $setcookie->setValue($value);
        $setcookie->setDomain($domain);
        $jar->setCookie($setcookie);
      }
    }

    // @todo Add try/catch.
    $options = ['allow_redirects' => FALSE, 'cookies' => $jar];
    $res2 = $this->http->request('GET', $url, $options);
    $contents = $res2->getBody()->getContents();

    return $contents;
  }
protected function getDaxkoPageSource ( $ url ) { $ config = $ this -> configFactory -> get ( 'openy_programs_search.settings' ) ; // @todo Add try/catch. $ options = [ 'allow_redirects' => FALSE ] ; $ res = $ this -> http -> request ( 'GET' , $ url , $ options ) ; $ cookies = $ res -> getHeader ( 'Set-Cookie' ) ; $ final = [ ] ; $ domain = '.' . $ config -> get ( 'domain' ) ; foreach ( $ cookies as $ cookie ) { $ parts = explode ( ';' , $ cookie ) ; foreach ( $ parts as $ part ) { $ parts2 = explode ( '=' , $ part ) ; if ( ! empty ( $ parts2 [ 1 ] ) ) { $ final [ trim ( $ parts2 [ 0 ] ) ] = trim ( $ parts2 [ 1 ] ) ; if ( strtolower ( $ parts2 [ 0 ] ) == 'domain' ) { $ domain = $ parts2 [ 1 ] ; } } } } $ jar = new CookieJar ( ) ; foreach ( $ final as $ key => $ value ) { if ( strtolower ( $ key ) != 'domain' ) { $ setcookie = new SetCookie ( ) ; $ setcookie -> setName ( $ key ) ; $ setcookie -> setValue ( $ value ) ; $ setcookie -> setDomain ( $ domain ) ; $ jar -> setCookie ( $ setcookie ) ; } } // @todo Add try/catch. $ options = [ 'allow_redirects' => FALSE , 'cookies' => $ jar ] ; $ res2 = $ this -> http -> request ( 'GET' , $ url , $ options ) ; $ contents = $ res2 -> getBody ( ) -> getContents ( ) ; return $ contents ; }
Get page source for Daxko html page.

@param string $url
Url of the page.

@return string
Page source.
Get page source for Daxko html page .