Created
July 12, 2022 12:53
-
-
Save k1zn/2c55721a1468e57b57c1dd357786c3ac to your computer and use it in GitHub Desktop.
httpRequest with cookies example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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