Skip to content

Instantly share code, notes, and snippets.

@k1zn
Created July 12, 2022 12:53
Show Gist options
  • Select an option

  • Save k1zn/2c55721a1468e57b57c1dd357786c3ac to your computer and use it in GitHub Desktop.

Select an option

Save k1zn/2c55721a1468e57b57c1dd357786c3ac to your computer and use it in GitHub Desktop.
httpRequest with cookies example
-- https://www.blast.hk/threads/20532/
-- thank BBooGG
local responseBody = {}
local req = {
url = 'https://yondime.tk/',
method = 'GET',
headers = {
['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
['cookies'] = 'example=1'
},
sink = require('ltn12').sink.table(responseBody)
}
httpRequest(req, nil,
function(_, code, headers, status)
local response = table.concat(responseBody)
if response then
print(response)
else
print(code)
end
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment