React\HttpClient\Response::getHeaders PHP Method

getHeaders() public method

public getHeaders ( )
    public function getHeaders()
    {
        return $this->headers;
    }

Usage Example

コード例 #1
0
ファイル: Loader.php プロジェクト: softwarevamp/homer
 public function onLoad($body)
 {
     $this->done = true;
     $headers = $this->response->getHeaders();
     if (isset($headers['Location'])) {
         if ($this->deep > 0) {
             $this->pushQueue($headers['Location'], $this->deep - 1);
         }
         return;
     }
     $html = new Crawler();
     $html->addHtmlContent($body);
     $this->search->index($this->url, $html);
     if ($this->deep > 0) {
         $base = parse_url($this->url);
         $links = $html->filter('a');
         $links->each(function (Crawler $link) use($base) {
             $href = explode('#', $link->attr('href'))[0];
             $href = trim($href);
             if (empty($href)) {
                 return;
             }
             if ('/' === $href) {
                 return;
             }
             if (preg_match('/^https?:\\/\\//i', $href)) {
                 $url = $href;
             } else {
                 if (0 === strpos($href, '/')) {
                     $url = $base['scheme'] . '://' . $base['host'] . $href;
                 } else {
                     $url = $base['scheme'] . '://' . $base['host'] . (isset($base['path']) ? $base['path'] : '/') . $href;
                 }
             }
             if (HOMER_KEEP_HOST && $base['host'] !== parse_url($url, PHP_URL_HOST)) {
                 return;
             }
             $this->pushQueue($url, $this->deep - 1);
         });
     }
 }
All Usage Examples Of React\HttpClient\Response::getHeaders