I'm using the following functions to get the final URL from a series of ... Just scanning (for a second) your code does not show any obvious ...
www.google.com.tw