lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am trying to learn a bit more about how to download a webpage using LuaSocket. What I was trying to do was download the English Premier league results from . That was easy to achieve with this code

local http = require("socket.http")
local ltn12 = require("ltn12")

    fileHandle =[[c:\_resultsFile.html]], "w")
    url1= [[]]

            url = "">             sink = ltn12.sink.file(fileHandle),

This is the front page however, what I want to get is all of the Premier league results. I.e manually navigating the webpage I would select "Premier League" from the left most drop down window.  I can see from looking at the page source this is achieved by sending a GET string

If I sniff the data actually sent from the webpage when I click on "Premier League", I see

GET /bbc/bbc/s? HTTP/1.1

where the gist of the GET selection for the Premier league appears to be      select_change_option_value=competition-118996114

At this point I am stuck, how do I specifiy this GET selection string in the Lua example above ?

Do I add it to the Lua table that is passed to http.request() ? Or more likely do I just append it somehow to the basic site url ?

I have tried numerous variations of adding this to the url but so far cant get it to download the page I want.

Any tips on how to get this http GET to work would be most appreciated. Thanks