Skip to content
Advertisement

PHP/Postman – How to populate the $Get

I am trying to do a Get request with Postman to a PHP script. But it doesn’t seem to populate the $_GET array? Why is this happening?

http://localhost/download.php/game

<?php
$config = (object) ['localhost' => 'localhost', 'dbusername' => 'root', 'dbpassword' => '', 'dbname' => 'test', 'tablename' => 'tablename'];

echo "Succesfull request";
echo htmlspecialchars($_GET["game"]);
if (isset($_GET['game'])) {
    echo "It's a get request!";
}

Advertisement

Answer

If you are not sure whether $_GET[‘game’] is empty or not try using var_dump($_GET[‘game’] to first check the content of the array. Also you will need to include the get parameter within the link somewhat like this: yourdomain/download.php?game=variable. Also change your double quotation marks when trying to access $_GET to single marks.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement