07.09.2020, 06:56
Hi all,
I’m trying to get some vistapool information integrated in my logicmachine. The information is available in json format after a successful login is accomplished on the site. I have tried the following script but can’t get the parameters overview file. Any help/suggestions?
http = require('socket.http')
ltn12 = require('ltn12')
json = require('json')
user = 'joost@xxxxxx.xxx'
pass = 'xxxxxx'
remember_password = '0'
entrar = 'Enter'
poolid = 'xxxx'
resp = {}
url1 = 'http://www.vistapool.es/en/login/login'
url2 = 'http://www.vistapool.es/en/pool/getmainvalues?id=xxxx'
data = [[{
"user": "joost@xxxxxx.xxxx",
"pass": "xxxx",
"remember_password": "0",
"entrar": "Enter"
}]]
res, err, hdrs = http.request(url1, data)
log(res, err, hdrs)
if res then
tbl = {}
res, err = 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
I get the following in the log (no error log, no alert info neither)
string: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es_ES" lang="es_ES">
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="sfiles/css/IE.css">
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<head>
<title>DA-GEN | DA-GEN | Accede a tu cuenta</title>
<meta http-equiv="charset" content="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="es_ES" />
<meta http-equiv="X-UA-Compatible" content="IE=edge env=best-standards-support" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes" />
<meta name="robots" content="index,follow" />
<link href="/sfiles/css/footable.core.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/footable.standalone.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-select.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-formhelpers.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/plugins/chosen/chosen.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-clockpicker.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-datetimepicker-ok.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/plugins/daterangepicker/daterangepicker-bs3.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/template.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/custom.css" media="screen" rel="stylesheet" type="..
Thank you for any help/suggestions,
regards,
Joost
I’m trying to get some vistapool information integrated in my logicmachine. The information is available in json format after a successful login is accomplished on the site. I have tried the following script but can’t get the parameters overview file. Any help/suggestions?
http = require('socket.http')
ltn12 = require('ltn12')
json = require('json')
user = 'joost@xxxxxx.xxx'
pass = 'xxxxxx'
remember_password = '0'
entrar = 'Enter'
poolid = 'xxxx'
resp = {}
url1 = 'http://www.vistapool.es/en/login/login'
url2 = 'http://www.vistapool.es/en/pool/getmainvalues?id=xxxx'
data = [[{
"user": "joost@xxxxxx.xxxx",
"pass": "xxxx",
"remember_password": "0",
"entrar": "Enter"
}]]
res, err, hdrs = http.request(url1, data)
log(res, err, hdrs)
if res then
tbl = {}
res, err = 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
I get the following in the log (no error log, no alert info neither)
string: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es_ES" lang="es_ES">
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="sfiles/css/IE.css">
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<head>
<title>DA-GEN | DA-GEN | Accede a tu cuenta</title>
<meta http-equiv="charset" content="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="es_ES" />
<meta http-equiv="X-UA-Compatible" content="IE=edge env=best-standards-support" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes" />
<meta name="robots" content="index,follow" />
<link href="/sfiles/css/footable.core.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/footable.standalone.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-select.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-formhelpers.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/plugins/chosen/chosen.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-clockpicker.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap-datetimepicker-ok.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/plugins/daterangepicker/daterangepicker-bs3.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/template.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/sfiles/css/custom.css" media="screen" rel="stylesheet" type="..
Thank you for any help/suggestions,
regards,
Joost