01.04.2017, 21:35
(This post was last modified: 01.04.2017, 21:35 by Erwin van der Zwart.)
Hi,
I adjusted the sample to a (tested) version to fetch all the main topics from this forum
BR,
Erwin
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