Why not use `parse_url()`?