I have a HTML form field $_POST[\"url\"] having some URL strings as the value. Example values are:
$_POST[\"url\"]
https://example.com/test/1234?email=xyz@test.com
$uri = $_SERVER["REQUEST_URI"]; $uriArray = explode('/', $uri); $page_url = $uriArray[1]; $page_url2 = $uriArray[2]; echo $page_url; <- see the value
This is working great for me using php