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.

http.request more then 1 command in the same session
#7
(19.02.2019, 09:16)admin Wrote: So then you just need to pass cookie header to the next request:
Code:
require('socket.http')
socket.http.TIMEOUT = 5

url1 = ...
url2 = ...

res, err, hdrs = socket.http.request(url1)

if res then
 tbl = {}
 res, err = socket.http.request({
   url = url2,
   headers = {
     cookie = hdrs['set-cookie']
   },
   sink = ltn12.sink.table(tbl),
 })

 if res then
   resp = table.concat(tbl)
   log(resp)
 else
   alert('request 2 failed: ' .. tostring(err))
 end
else
 alert('request 1 failed: ' .. tostring(err))
end

Yeah, thanks it works!!
Reply


Messages In This Thread
RE: http.request more then 1 command in the same session - by gjniewenhuijse - 19.02.2019, 09:43

Forum Jump: