Ok, I'm confused.
You are using PHP to edit other PHP files remotely?
If so, the security concerns here are mind-boggling.
You would just search for every occurance of <a href="something.php with strpos(); and use substr() to insert things.
Or are you trying to extract the filename before the ? and the values after the ? from within the PHP script receiving the ? values?
If so,
the filename is $SERVER['PHP_SELF']
everything after the ? is stored in $SERVER['QUERY_STRING]
and you can also access the individual values after the ? with $_GET['']
music.php?city=nashville&type=blues&artist=Elvis
$SERVER['PHP_SELF'] = music.php
$SERVER['QUERY_STRING] = city=nashville&type=blues&artist=Elvis
$GET['city']=nashville
$GET['type']=blues
$_GET['artist']=Elvis