Exemple #1
0
 /**
  *    Fetches a URL as a response object. Will keep trying if redirected.
  *    It will also collect authentication realm information.
  *    @param string/SimpleUrl $url      Target to fetch.
  *    @param SimpleEncoding $encoding   Additional parameters for request.
  *    @return SimpleHttpResponse        Hopefully the target page.
  *    @access public
  */
 function fetchResponse($url, $encoding)
 {
     if ($encoding->getMethod() != 'POST') {
         $url->addRequestParameters($encoding);
         $encoding->clear();
     }
     $response = $this->fetchWhileRedirected($url, $encoding);
     if ($headers = $response->getHeaders()) {
         if ($headers->isChallenge()) {
             $this->authenticator->addRealm($url, $headers->getAuthentication(), $headers->getRealm());
         }
     }
     return $response;
 }
Exemple #2
0
 /**
  *    Fetches a URL as a response object. Will keep trying if redirected.
  *    It will also collect authentication realm information.
  *    @param string $method                   GET, POST, etc.
  *    @param string/SimpleUrl $url            Target to fetch.
  *    @param SimpleFormEncoding $parameters   Additional parameters for request.
  *    @return SimpleHttpResponse              Hopefully the target page.
  *    @access public
  */
 function &fetchResponse($method, $url, $parameters = false)
 {
     if ($method != 'POST') {
         $url->addRequestParameters($parameters);
         $parameters = false;
     }
     $response =& $this->_fetchWhileRedirected($method, $url, $parameters);
     if ($headers = $response->getHeaders()) {
         if ($headers->isChallenge()) {
             $this->_authenticator->addRealm($url, $headers->getAuthentication(), $headers->getRealm());
         }
     }
     return $response;
 }