PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: TyShkan on 17 August, 2004, 18:00:07

Title: site-reader
Post by: TyShkan on 17 August, 2004, 18:00:07
GETHTML = "GET /lol.php HTTP/1.1\r\nHost: xhub.ultranet.ru\r\nUser-Agent: Mozilla/4.0 (compatible; LUA 4.0; LUA 4.0)\r\n"

Bot = "::[X]::"

function GetNews(user)
local socket, err = connect("xhub.ultranet.ru", 80)
local code = ""
if not err then
socket:timeout(2)
socket:send(GETHTML..strchar(13,10))
local line = ""
while not err do
line, err = socket:receive("*l")
code = code..line
end
socket:close()
end
socket:close()
user:SendData(Bot, code)
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(Bot)) == "$To: "..Bot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!go") then
GetNews(user)
end
end
end


Page is now accessible at http://xhub.ultranet.ru/lol.php and contains code:Hi!))\r\n\r\nOooOoooOooo

When i writing !go, this script return code:HTTP/1.1 200 OKDate: Mon, 16 Aug 2004 10:24:33 GMTServer: Apache/1.3.29 (Unix) mod_become/1.3 PHP/4.3.5 mod_layout/3.2X-Powered-By: PHP/4.3.5Connection: closeTransfer-Encoding: chunkedContent-Type: text/html14 Hi!))\r\n\r\nOooOoooOooo0

What i would change, that the script would understand "\n", etc and showing code:Hi!))\r\n\r\nOooOoooOoooas code:Hi!))

OooOoooOooo
in dc? And how i can check, are there changes on the site and if they are not present to read beforehand saved version from a file...

Thanks, --X--
Title:
Post by: plop on 17 August, 2004, 19:15:56
no need 2 change anything, dc++ handles the \r\n as a new line.
when you type it yourself from the chat, dc++ escapes it so it shows as plain text.

plop
Title:
Post by: TyShkan on 17 August, 2004, 19:59:54
hm, sorry, but i seen that, when enter command "!go":
[21:52:00] <::[X]::> HTTP/1.1 200 OKDate: Tue, 17 Aug 2004 17:51:59 GMTServer: Apache/1.3.29 (Unix) mod_become/1.3 PHP/4.3.5 mod_layout/3.2X-Powered-By: PHP/4.3.5Connection: closeTransfer-Encoding: chunkedContent-Type: text/html18 Hi!))\r\n\r\nOooOoooOooo0
Title:
Post by: TyShkan on 18 August, 2004, 23:42:52
Why ptokax showing "\r\n"???