When I need to find a variable, I usually do one of three things.
1) Use a php block to loop through variables using either $_REQUEST or $_COOKIE such as
foreach($_REQUEST as $key=>$val) {
echo $key . ": " . $val . "<br/>";
}
2) Or I use the command get_defined_vars(); to find out some variables that are available
Once I find what the variable key is, I then can assign it and/or append it to the URL like you are wanting.
3) Or...depending on the page that I'm on, I'll go into the Dolphin Classes and use the native Dolphin class variables. For example, if I'm doing something on the profile page, I will probably look into the templates/base/scripts/BxBaseProfileView.php file and look for something like $this->_iProfileID (I'm not sure if this is the var but it will be something like that. I would this assign this to my own variable ....such as $myprofileid = $this->_iProfileID;
I would then append to the URL like your want...such as www.website.com/?idFriend=<?php echo $myprofileid; ?>
I was moving kinda' fast because I was just breezing through and saw your question. I hope this helps you in some way.