diff --git a/src/Library/WebRequest.php b/src/Library/WebRequest.php index d8ec6f2..353fd57 100644 --- a/src/Library/WebRequest.php +++ b/src/Library/WebRequest.php @@ -460,4 +460,16 @@ public static function contentSize($url){ return 0; return (float)$data['headers']['Content-Length']; } + + public static function lastRedirection($url){ + $ch = curl_init($url); + + curl_setopt($ch, CURLOPT_USERAGENT, self::$userAgent); + curl_setopt($ch, CURLOPT_HEADER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_exec($ch); + + return curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); + } } \ No newline at end of file