I am relatively new to RBP3 and what it can do, but Ill try to summarize what I want to do and maybe I can get some pointers in the right direction. 

So the idea is to have a web app running on a PHP server connected to a regular database. The RBP acts as a middleman. When a user enters a code on the website, the RBP (which is stored off-site) sends a signal to a switch relay which in turn triggers an unlock mechanism to a specific door (based on the code entered by the user).

I have provided an image of how the flow is supposed to go. [![Flow ](https://i.stack.imgur.com/GySbS.jpg)](https://i.stack.imgur.com/GySbS.jpg)

I am a bit confused in which end to start. But the idea is that the web server sends a request to the RBP. For this - would I need a web server running on the RBP, or is it possible to accept/send requests from a single IP address without configuring a whole apache web server on the Pi?

As you probably can tell I am a little lost in which string to pull, so what would your suggestion be for handling the incoming requests and the possibility to send requests?

EDIT: I will try to provide a bit more clarity in this. The doors are connected to a WAGO coupler, which in turn is connected to the RBP over VPN. 

The role of the RBP is to recieve a request from the PHP Server, check if the door is open or closed, and if it's closed it will send a signal to the coupler to open the door. The RBP will then send a message back to the server saying the door is now open. 

From your replies I have realized HTTP might not be the best protocol, and I will instead look into MQTT and other protocols for this project. I might be biting off more than I can chew here, but I really need to get this to work which is why I am looking for a bit of guidance. 

Thanks