The $_SERVER['QUERY_STRING'] variable gives you the entire query string of the url ie. all after the ? in the url. Use as follows: For http://www.somesite.com/?ref=123&bus=abc echo $_SERVER['QUERY_STRING']; will return: ref=123&bus=abc See also: