How to get a response Relay on off via PHP

HI,
I’m developing a dashboard in HTML/CSS/JS/PHP which will communicate with a Photon 2 relays to switch via buttons on and off electricity and gas.
When I call the API I get this:

{
“id”: “THIS HAS BEEN REMOVED”,
“name”: “THIS HAS BEEN REMOVED”,
“last_app”: null,
“last_ip_address”: “xx.xxx.xx.xx”,
“last_heard”: “2016-07-18T17:26:51.361Z”,
“product_id”: 6,
“connected”: true,
“platform_id”: 6,
“cellular”: false,
“status”: “normal”,
“variables”: {},
“functions”: [
“controlRelay”
]
}

What I’m trying to get is the Status of the Relay (not the hardware). For example, if I click button 1 for electricity, I 'd like the system to return a value to let me it’s on or off.
I presume I might be able to use the variables or functions but I can’t find the way the code should be structure.
Can someone help?
Thanks
Matt

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