How to get a response Relay on off via PHP

What role does PHP play in all of this, since HTML/Javascript should suffice? Have a look at this tutorial: