LiFx HTTP API Request with PHP

377 Views Asked by At

long shot, but has anyone managed to get the LiFx API to work from php?

I want to set-up a few simple commands from a web interface, posting to a php file, but I am not sure exactly how it all works.

http://developer.lifx.com/ Their documentation shows curl examples, which work in terminal. and I have found this example:

PHP HTTP CURL PUT request for LIFX Power On/Off

I have tried putting the code in from that stack overflow answer into a php fule and running it, but I get nothing, no response, error and nothing happens. I am a bit of a php novice, so if anyone has some insight, I would be interested to hear it.

Regards Kirt

2

There are 2 best solutions below

0
On

This is another long shot but I'll post an answer anyway just as an FYI for future readers.

There are several open source libraries out there for this. I wouldn't start a new one from scratch, I will research some of them and start using the one that looks easier on you and then contribute to the project. I can pinpoint one for you to get you started:

https://github.com/kz/lifx-php

0
On

I wrote a little PHP wrapper for LIFX. https://github.com/ewkcoder