The following code copy the URL of my "index.php" page
$url = "http://".$_SERVER['SERVER_NAME']."/".$_SERVER['REQUEST_URI'];
But I need to add this code to another website in iframe, so I need to get the URL of the other website as a parent URL
I guess you're talking about the referring URL. Use this
$_SERVER['HTTP_REFERER']
in the iframed page