am I right?: you have one script that contains some variables of global character, say constants you want to use in another script. now you want to grab only the constant assigning stuff and evaluate it.
have file 2 read in file 1, use either fopen, fread, ... or simply the file function.
locate the part that contains your variable assignments (strip the rest off). how to do this exactly, depends on your file 1 structure.
now evaluate the variable definition using the eval function.
the point is to locate only the part of file 1 that you need. maybe you can place some delimiters around it, eg. // ---XXX---.