//https://www.google.com/search?key=1234 $url = $_SERVER['REQUEST_URI']; $url_components = parse_url($url); parse_str($url_components['query'], $params); $key = $params['key']; // key=1234