提交 561c249e 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

update script

上级 a080f269
......@@ -6,25 +6,13 @@ pid=0
1. Load web page from url http://xxx
2. Retrieve img element zt-logo.png in html
3. Check img exist >> `.*.png`
3. Check img exist >> `必应`
]]
local http = require("socket.http") -- need luasocket library (luarocks install luasocket)
local ltn12 = require("ltn12")
require("socket")
local https = require("ssl.https") -- need luasocket, luasec modules
local body, code, headers, status = https.request("https://cn.bing.com")
function http.get(u)
local t = {}
local r, c, h = http.request{
url = u,
sink = ltn12.sink.table(t)}
return r, c, h, table.concat(t)
end
r,c,h,body = http.get("http://max.demo.zentao.net/user-login-Lw==.html")
if c~= 200 then
print("ERR: " .. c)
else
_, _, src = string.find(body, "<img%ssrc=\"(.-)\" .*>")
print(src)
end
_, _, src = string.find(body, "<title>(.-)</title>")
print(src)
......@@ -6,26 +6,13 @@ pid=0
1. Send a request to interface http://xxx
2. Retrieve sessionID field from response json
3. Check its format >> `^[a-z0-9]{26}`
3. Check its format >> `^[a-z0-9]{8}`
]]
local http = require("socket.http") -- need luasocket library (luarocks install luasocket)
local ltn12 = require("ltn12")
require("socket")
local https = require("ssl.https") -- need luasocket, luasec modules
local body, code, headers, status = https.request("https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1")
function http.get(u)
local t = {}
local r, c, h = http.request{
url = u,
sink = ltn12.sink.table(t)
}
return r, c, h, table.concat(t)
end
r, c, h,body = http.get("http://max.demo.zentao.net/pms/?mode=getconfig")
if c~= 200 then
print("ERR: " .. c)
else
_, _, src = string.find(body, '"sessionID":"(.-)"')
print(src)
end
_, _, src = string.find(body, '"startdate":"(.-)"')
print(src)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册