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.

Logic Machine Communication - HTTP
#3
Hi,

If you just need a simple datafield you can also use:

Code:
require('socket.http')
socket.http.TIMEOUT = 5

-- Get data from website
local data = socket.http.request('http://openrb.com')

-- Check if data is received
if not data then
    log('No data found')
    return
end

-- Find your data
for i in string.gmatch(data, '<body>.-</body>') do
    if i ~= nil then
        searched_data = i:match([[<h2>(.-)</h2>]])
        if i ~= nil then
            log(searched_data)
        end
    end
end
BR,

Erwin
Reply


Messages In This Thread
RE: Logic Machine Communication - HTTP - by Erwin van der Zwart - 31.03.2017, 14:22

Forum Jump: