I have a page that can have a link to in either one of the formats below:
When the query part of the URL is present, I need to capture it with PHP. I tried using parse_url but I’m not really sure how to use it. Tried this
echo (parse_url($_SERVER['REQUEST_URI']['query']));
but it returns Array…
The optional 2nd parameter of
parse_urlallows you to specify precisely what portion of URL you need:On the other hand, it is easier to use a server variable, if applicable: