Help - Search - Members - Calendar
Full Version: Check HTTP Header
Intellipool Network Monitor - Forum > Intellipool Network Monitor > Lua scripts
ofer kirshenbaum
Hi,
Does someone have LUA script that check http header ?

Thanks
Ofer
RA
Here is an example that downloads and prints the headers (and other things) from a server

CODE
------------------------------------------------------------------------------------------------
-- INM Lua API example (C) 2006 Intellipool AB
-- Script to download a html page from a web server
------------------------------------------------------------------------------------------------
http = TLuaHTTPClient()
-- Connect using the default parameters
iRet = http:Connect()
if iRet ~= 0 then
-- Make a GET request to default document
iRet = http:Get("/")
-- Print returned code from HTTP server
print("Code:"..iRet)
-- Extract content length
iRet = http:GetHeaderContentLength()
print("Content length:"..iRet)
-- Print content
string,iRet = http:GetContent(iRet)
print(string)
-- Print raw headers
string = http:GetHeadersRaw()
print("headers:\n"..string)
-- Print cookies
string = http:GetHeaderCookies()
print("Cookies:\n"..string)
-- Extract and print cookies one by one
iNumber = http:GetHeaderCookieCount()
for count = 0, iNumber-1 do
string = http:GetHeaderCookie(count)
print("Coookie #"..count.." "..string.."\n")
end
-- Extract location header
string = http:GetHeaderLocation();
print("location:\n"..string)
SetExitStatus("Test ok",true)
else
print("Connect failed")
SetExitStatus("Test failed",false)
end
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.