src/Extractor/HttpClient.php
private function getMetaRefreshURL($url, $html)
    {
        if ('' === $html) {
            return false;
        }

        // <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.bernama.com/bernama/v6/newsindex.php?id=943513">
        if (!preg_match('!<meta http-equiv=["\']?refresh["\']? content=["\']?[0-9];\s*url=["\']?([^"\'>]+)["\']?!i', $html, $match)) {
            return false;
        }

        $redirectUrl = str_replace('&amp;', '&', trim($match[1]));
        if (preg_match('!^https?://!i', $redirectUrl)) {
            // already absolute
            $this->logger->info('Meta refresh redirect found (http-equiv="refresh"), new URL: ' . $redirectUrl);

            return $redirectUrl;
        }

        // absolutize redirect URL
        $base = new \SimplePie_IRI($url);
        // remove '//' in URL path (causes URLs not to resolve properly)
        if (isset($base->ipath)) {
            $base->ipath = str_replace('//', '/', $base->ipath);
        }

        if ($absolute = \SimplePie_IRI::absolutize($base, $redirectUrl)) {
            $this->logger->info('Meta refresh redirect found (http-equiv="refresh"), new URL: ' . $absolute);

            return $absolute->get_iri();
        }

        return false;
    }
private function getMetaRefreshURL($url, $html)
    {
        if ('' === $html) {
            return false;
        }

        // <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.bernama.com/bernama/v6/newsindex.php?id=943513">
        if (!preg_match('!<meta http-equiv=["\']?refresh["\']? content=["\']?[0-9];\s*url=["\']?([^"\'>]+)["\']?!i', $html, $match)) {
            return false;
        }

        $redirectUrl = str_replace('&amp;', '&', trim($match[1]));
        if (preg_match('!^https?://!i', $redirectUrl)) {
            // already absolute
            $this->logger->info('Meta refresh redirect found (http-equiv="refresh"), new URL: ' . $redirectUrl);

            return $redirectUrl;
        }

        // absolutize redirect URL
        $base = new \SimplePie_IRI($url);
        // remove '//' in URL path (causes URLs not to resolve properly)
        if (isset($base->ipath)) {
            $base->ipath = str_replace('//', '/', $base->ipath);
        }

        if ($absolute = \SimplePie_IRI::absolutize($base, $redirectUrl)) {
            $this->logger->info('Meta refresh redirect found (http-equiv="refresh"), new URL: ' . $absolute);

            return $absolute->get_iri();
        }

        return false;
    }
private function getMetaRefreshURL ( $ url , $ html ) { if ( '' === $ html ) { return false ; } // <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.bernama.com/bernama/v6/newsindex.php?id=943513"> if ( ! preg_match ( '!<meta http-equiv=["\']?refresh["\']? content=["\']?[0-9];\s*url=["\']?([^"\'>]+)["\']?!i' , $ html , $ match ) ) { return false ; } $ redirectUrl = str_replace ( '&amp;' , '&' , trim ( $ match [ 1 ] ) ) ; if ( preg_match ( '!^https?://!i' , $ redirectUrl ) ) { // already absolute $ this -> logger -> info ( 'Meta refresh redirect found (http-equiv="refresh"), new URL: ' . $ redirectUrl ) ; return $ redirectUrl ; } // absolutize redirect URL $ base = new \ SimplePie_IRI ( $ url ) ; // remove '//' in URL path (causes URLs not to resolve properly) if ( isset ( $ base -> ipath ) ) { $ base -> ipath = str_replace ( '//' , '/' , $ base -> ipath ) ; } if ( $ absolute = \ SimplePie_IRI :: absolutize ( $ base , $ redirectUrl ) ) { $ this -> logger -> info ( 'Meta refresh redirect found (http-equiv="refresh"), new URL: ' . $ absolute ) ; return $ absolute -> get_iri ( ) ; } return false ; }
Try to find the refresh url from the meta.

@param string $url  Absolute url
@param string $html First characters of the response (hopefully it'll be enough to find some meta)

@return false|string
Try to find the refresh url from the meta .