Home > Enterprise >  How can I get php to respond to get request?
How can I get php to respond to get request?

Time:05-06

As a preface I would like to say that I am very new to php AND to stack overflow so this is a very beginner question.

For some context: I am doing an ubuntu autoinstall and am following the following forum post for some extra settings I'm trying to do: https://askubuntu.com/questions/1290624/fetch-autoinstall-based-on-mac

So the installer does a curl command which if understand correctly sends a GET request to the http server which will run some php code and finally return an edited file (is what is supposed to happen). How can i get a php environment up and running to do just this?

I have the apache http server running which I can use to get files with curl, I just need to know how to "catch" the get request and send back an edited file.

CodePudding user response:

just create a PHP file in your webserver root directory then send your request to http://yourserver/your_php_file.php Your webserver will call the file your_php_file.php and this file will have to send back an edited file ;)

CodePudding user response:

Try with a simple index.php file and navigate to it via the URL. The index.php file can be just this for starter:

<?php 

var_dump($_GET); 

and after you see what is $_GET (and I recommend read about it) you will figure out what to do next :)

  • Related