Envoyer Curl Harmony via un script lua
Publié : 07 déc. 2016, 18:12
Bonsoir, j'essaye d'envoyer un curl via un script lua, mon curl est le suivant
Si je le lance dans un terminal il fait sa fonction (envoi d'une commande Harmony)
Mais je n'arrive pa à l'intégrer dans un script lua, j'ai essayé ça
Mais j'ai une erreur de syntaxe à priori, sauriez vous m'aider
Code : Tout sélectionner
curl 'http://192.168.1.17:8085/api/test/lights/21/state' -X PUT -H 'Origin: http://192.168.1.17:8085' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: fr,en-US;q=0.8,en;q=0.6' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://192.168.1.17:8085/' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '{"on":true}' --compressedMais je n'arrive pa à l'intégrer dans un script lua, j'ai essayé ça
Code : Tout sélectionner
runcommand = "curl 'http://192.168.1.17:8085/api/test/lights/21/state' -X PUT -H 'Origin: http://192.168.1.17:8085' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: fr,en-US;q=0.8,en;q=0.6' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://192.168.1.17:8085/' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '{"on":true}' --compressed";
os.execute(runcommand);
return commandArray