GET Request URL parameter

Check if the url parameter exists in the GET request

Fetching request parameters in GET request

Use the $_GET reserved variable to access the GET request variables

Check if url parameter exists

isset — Determine if a variable is declared and is different than null

if(isset($_GET['d']) && isset($_GET['t']) ) {
//do something with the parameters
}else{
    //throw an error or handle the lack of parameters
}

Handling url as get request parameter

The url is encoded in the request, we should decode the url using urldecode.

http://localhost/test.php?id=http%3A%2F%2Fgoogle.com%2F%3Fvar%3D234%26key%3D234

For the above url

echo urldecode($_GET["id"]);

We can use htmlspecialchars function to escape the escape characters.