What are alternative methods to retrieve the URI of a page within a frameset using PHP?

When a page is within a frameset, the $_SERVER['REQUEST_URI'] variable may not accurately reflect the URI of the current page due to the frameset structure. One alternative method to retrieve the URI of a page within a frameset using PHP is to use JavaScript to access the parent window's location and pass it to PHP via a form submission or AJAX request.

<?php
// PHP code to retrieve the URI of a page within a frameset using JavaScript
echo '<script>';
echo 'var parentURI = window.parent.location.href;';
echo 'document.write("<form id=\"uriForm\" action=\"process_uri.php\" method=\"post\"><input type=\"hidden\" name=\"uri\" value=\""+parentURI+"\"></form>");';
echo 'document.getElementById("uriForm").submit();';
echo '</script>';
?>