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
#7
Hi,

I adjusted the sample to a (tested) version to fetch all the main topics from this forum

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

-- Get data from website
local data = socket.http.request('http://forum.logicmachine.net')

-- 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
     for j in string.gmatch(i, '<a href="forumdisplay.-</a>') do
        if j ~= nil then
           searched_data = j:match([[">(.-)</a>]])
           if searched_data ~= nil then
              log(searched_data)
           end
        end
     end
  end
end

BR,

Erwin
Reply


Messages In This Thread
RE: Logic Machine Communication - HTTP - by Erwin van der Zwart - 01.04.2017, 21:35

Forum Jump: