public static function expandShortUrl($shortURL)
    {
        if (empty($shortURL)) {
            return false;
        }

        $headers = get_headers($shortURL, 1);
        if (isset($headers['Location'])) {
            return $headers['Location'];
        }

        $data = self::curl($shortURL);

        preg_match_all('/<[\s]*meta[\s]*http-equiv="?'.'([^>"]*)"?[\s]*'.'content="?([^>"]*)"?[\s]*[\/]?[\s]*>/si', $data, $match);

        if (isset($match) && is_array($match) && count($match) == 3) {
            $originals = $match[0];
            $names = $match[1];
            $values = $match[2];
            if ((isset($originals) && isset($names) && isset($values)) && count($originals) == count($names) && count($names) == count($values)) {
                $metaTags = [];
                for ($i = 0, $limit = count($names); $i < $limit; $i++) {
                    $metaTags[$names[$i]] = ['html' => htmlentities($originals[$i]), 'value' => $values[$i]];
                }
            }
        }

        if (isset($metaTags['refresh']['value']) && !empty($metaTags['refresh']['value'])) {
            $returnData = explode('=', $metaTags['refresh']['value']);
            if (isset($returnData[1]) && !empty($returnData[1])) {
                return $returnData[1];
            }
        }

        return false;
    }
public static function expandShortUrl($shortURL)
    {
        if (empty($shortURL)) {
            return false;
        }

        $headers = get_headers($shortURL, 1);
        if (isset($headers['Location'])) {
            return $headers['Location'];
        }

        $data = self::curl($shortURL);

        preg_match_all('/<[\s]*meta[\s]*http-equiv="?'.'([^>"]*)"?[\s]*'.'content="?([^>"]*)"?[\s]*[\/]?[\s]*>/si', $data, $match);

        if (isset($match) && is_array($match) && count($match) == 3) {
            $originals = $match[0];
            $names = $match[1];
            $values = $match[2];
            if ((isset($originals) && isset($names) && isset($values)) && count($originals) == count($names) && count($names) == count($values)) {
                $metaTags = [];
                for ($i = 0, $limit = count($names); $i < $limit; $i++) {
                    $metaTags[$names[$i]] = ['html' => htmlentities($originals[$i]), 'value' => $values[$i]];
                }
            }
        }

        if (isset($metaTags['refresh']['value']) && !empty($metaTags['refresh']['value'])) {
            $returnData = explode('=', $metaTags['refresh']['value']);
            if (isset($returnData[1]) && !empty($returnData[1])) {
                return $returnData[1];
            }
        }

        return false;
    }
public static function expandShortUrl ( $ shortURL ) { if ( empty ( $ shortURL ) ) { return false ; } $ headers = get_headers ( $ shortURL , 1 ) ; if ( isset ( $ headers [ 'Location' ] ) ) { return $ headers [ 'Location' ] ; } $ data = self :: curl ( $ shortURL ) ; preg_match_all ( '/<[\s]*meta[\s]*http-equiv="?' . '([^>"]*)"?[\s]*' . 'content="?([^>"]*)"?[\s]*[\/]?[\s]*>/si' , $ data , $ match ) ; if ( isset ( $ match ) && is_array ( $ match ) && count ( $ match ) == 3 ) { $ originals = $ match [ 0 ] ; $ names = $ match [ 1 ] ; $ values = $ match [ 2 ] ; if ( ( isset ( $ originals ) && isset ( $ names ) && isset ( $ values ) ) && count ( $ originals ) == count ( $ names ) && count ( $ names ) == count ( $ values ) ) { $ metaTags = [ ] ; for ( $ i = 0 , $ limit = count ( $ names ) ; $ i < $ limit ; $ i ++ ) { $ metaTags [ $ names [ $ i ] ] = [ 'html' => htmlentities ( $ originals [ $ i ] ) , 'value' => $ values [ $ i ] ] ; } } } if ( isset ( $ metaTags [ 'refresh' ] [ 'value' ] ) && ! empty ( $ metaTags [ 'refresh' ] [ 'value' ] ) ) { $ returnData = explode ( '=' , $ metaTags [ 'refresh' ] [ 'value' ] ) ; if ( isset ( $ returnData [ 1 ] ) && ! empty ( $ returnData [ 1 ] ) ) { return $ returnData [ 1 ] ; } } return false ; }
Get information on a short URL. Find out where it forwards.

@param string $shortURL shortened URL

@return mixed full url or false
Get information on a short URL . Find out where it forwards .