/** * get_final_url() * Gets the address that the URL ultimately leads to. * Returns $url itself if it isn't a redirect. * * @param string $url * @return string */ function get_final_url($url){ $redirects = hwd_vs_tools::get_all_redirects($url); if (count($redirects)>0){ return array_pop($redirects); } else { return $url; } }