On your first question,
$iam = "http://$HTTP_HOST$PHP_SELF";
$HTTP_HOST is a server var; $PHP_SELF is a PHP var. You probably don't need to worry about the difference unless you do something to create an ambiguity.
On your second question: I'm not sure I understand what you're asking, but here's an attempt. include() on a local file pulls in the text of the file. If the file includes PHP code, properly escaped, it will be processed by your Web server as if it were part of the parent file.
But include() on a remote file through HTTP may work differently. If you are pulling in PHP code from a server that has PHP turned on, the PHP will be interpreted remotely, not locally. In that case, variables in your PHP file will not be made available remotely (you could, of course, pass them as arguments).