Fix urlencode issue and add port
Previously urlencode would encode the full url, where as the ideal functionality is to URL encode just the query parameters. This has now been fixed.
I have also added the ability to add a port and parse the port from a URL string, so that local development is easier - and those services that require a port can be used nicely.