Refactor method to get IP base on a URL