Referrer should do the trick
echo $_SERVER['HTTP_REFERER']
from within your php script
Just to get more specific:
Page1 makes a call to Page2. You'd then output the variable above to find the url of page1. If you need the url of page2, then you would use:
$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
You should check if these exist before trying to access them. I sometimes do this:
$server = array_merge(array('HTTP_HOST'=>null, 'REQUEST_URI'=>null, 'HTTP_REFERER'=>null), $_SERVER);
I would then access the variable "$server" instead of $_SERVER. Alternatively, you could use @$_SERVER[] too which will generally supress errors.