This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Help to read html code
#2
Hi,

Try this:
Code:
require('socket.http')
socket.http.TIMEOUT = 5
data = socket.http.request('http://192.168.1.238/en/phase1.html')

-- Check if response value is received
if data then
  -- Fetch values from HTTP response
  p_activa = data:match([[<td id="p_activa">(.-)</td>]])
  -- Remove units and trims leading and trailing spaces and decode to numberic
  p_activa = tonumber(string.trim(string.gsub(p_activa, "W", "", 1)))
  -- Write to KMX
  grp.write('1/1/1', p_activa)
end
BR,

Erwin
Reply


Messages In This Thread
Help to read html code - by peyoe - 21.11.2019, 22:13
RE: Help to read html code - by Erwin van der Zwart - 22.11.2019, 00:06
RE: Help to read html code - by peyoe - 22.11.2019, 08:01
RE: Help to read html code - by admin - 22.11.2019, 08:04
RE: Help to read html code - by peyoe - 22.11.2019, 08:35
RE: Help to read html code - by admin - 22.11.2019, 09:03
RE: Help to read html code - by peyoe - 22.11.2019, 09:30
RE: Help to read html code - by Daniel - 22.11.2019, 09:57
RE: Help to read html code - by peyoe - 22.11.2019, 10:22
RE: Help to read html code - by peyoe - 22.11.2019, 15:07
RE: Help to read html code - by Daniel - 22.11.2019, 15:15
RE: Help to read html code - by peyoe - 22.11.2019, 15:30
RE: Help to read html code - by peyoe - 25.11.2019, 12:30
RE: Help to read html code - by Joep - 14.12.2019, 15:09

Forum Jump: