Home / PHP Tips Generated By ChatGPT / Parsing URL Components in PHP Use parse_url() to break down a URL into its components. Source Code $url = 'http://username:password@hostname:9090/path?arg=value#anchor'; print_r(parse_url($url));