encode final URL in phantomjs