Using parse_url

Changing the code to use parse_url instead of string functions