User Tools

Site Tools


playground:docu_http

Send an http(s) GET or POST request

Installation instructions

  1. Download the lua code to your computer from here
  2. Move or copy the lua file to /usr/local/lib/pilight/actions/
  3. Make the file executable: chmod +x /usr/local/lib/pilight/actions/http.lua

Options for GET

NameRequiredMultiple ValuesDescription
GETyesnoThe url for a GET request
PARAMnonoAn optional parameterstring for a GET request

Options for POST

NameRequiredMultiple ValuesDescription
POSTyesnoThe url for a POST request
PARAMyesnoA parameterstring required for a POST request
MIMETYPEyesnoThe mimetype required for a POST request

Examples

   IF 1 == 1 THEN http GET 'http://www.somewebsite.com/'
   
   IF 1 == 1 THEN http GET 'https://www.somewebsite.com/' PARAM 'command=show&format=xml'
   
   IF 1 == 1 THEN http POST 'http://www.somewebsite.com/' PARAM 'command=show' MIMETYPE 'text/plain'
   
   IF 1 == 1 THEN http GET 'http://192.168.1.1/myserver/' 
playground/docu_http.txt · Last modified: 2018/07/16 13:49 by Niek