site-reader
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

site-reader

Started by TyShkan, 14 August, 2004, 22:23:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TyShkan

who can give me a script, that can connect to site and read information from them, then converting
to \n, etc. and save the information to the file news.txt...
Who can help?

Herodes

Since there are unlimited ways to provide data through html or any other type of web document a universal site reader is not possible ... even if it is it wouldn't be practical ...
I would say that having a standard html data structure could make this possible ....
Pls provide an address from where you need the news to be read from....

What u asked for would be ok with

gsub(data, "
", "\r\n") ... maybe :)

TyShkan

#2
i'm reading news from special-formatted page, which generated php-script, this page is now not accessible...i'm don't finish works on it...how i can grab data from site?

Herodes

You can find c h i l l a's Exchange Converter script here
Scroll down to the GetRates function ...
It gives a nice example of how to connect to a site and get specific data out of it ...
although personally I have never tried scripting smth like that ... :)

TyShkan

#4
--to deleting--

TyShkan

#5
--to deleting--

Herodes

I see now that u have been trying to grab
Hi!))\n\nOooOoooOooo
dont forget to try also with "\r\n" apart from "\n"

TyShkan

#7
Hi! Using this script I have written own=)
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
Hi!))\r\n\r\nOooOoooOooo

When i writing !go, this script return
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
Hi!))\r\n\r\nOooOoooOooo
as
Hi!))

OooOoooOooo
in dc?
Thanks ;)

SMF spam blocked by CleanTalk