Exemple #1
0
 public function load($url)
 {
     $descriptor =& $this->getDescriptor();
     $this->setOption($descriptor, CURLOPT_URL, $url);
     $this->setOptions($descriptor);
     $answer = $this->exec();
     $descriptor['info'] = curl_getinfo($descriptor['descriptor']);
     $descriptor['info']['error'] = curl_error($descriptor['descriptor']);
     $descriptor['info']['header'] = HttpHeader::cutHeader($answer);
     if (HttpHeader::isRedirect($descriptor['info']['http_code'])) {
         if ($this->useRedirect()) {
             $this->setReferer($url, $descriptor);
             $answer = $this->load($descriptor['info']['redirect_url']);
         }
     }
     $this->setRedirectCount(0);
     $this->setAnswer($answer);
     $this->reInit();
     return $this->getAnswer();
 }