I would love to see if there are better ways of doing this, the url-encode breaks urls that have unusual characters in it.