Author Topic: Best way to read data from a website ie returntoblockland [solved]  (Read 1210 times)

I want to know the easiest way on how to read the id list on rtb, but i'm not sure how to start can someone direct me towards a tutorial or explain?
« Last Edit: July 21, 2013, 09:41:13 PM by swollow »

Does it have to be torquescript

Does it have to be torquescript
yes, im not only using this for getting the id's I want it as a reference aswell

yes, im not only using this for getting the id's I want it as a reference aswell
gl then

try using ephis xml parser from rtb

Maybe the id lookup is part of the API, ask him before trying to parse the huge web page

If you just want to say, get all the IDS from 1 page of the ID list then you can use this script, just call Collector.CollectPage(pagenum, filepath)

Code: [Select]
function Collector::onConnected(%this)
{
%this.send("GET" SPC %this.urlreq SPC "HTTP/1.1\nHost: forum.returntoblockland.com\nUser-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19\n\n");
}

function Collector::onLine(%this, %line)
{
    if(getSubStr(%Line, 0, 74) $= "    <td class=\"row1\" width=0 align=\"center\"><span class=\"genmed\"><a href=\"")
{
if(%this.debug){echo(%Line);}
%this.colent = true;
%Line = getSubStr(%Line, 95, strLen(%Line));
if(%this.debug) {echo(%Line);}
%this.curName = "";
%this.curID = getSubStr(%line, 0, strPos(%Line, "\""));
%this.nin = true;
}
else if(%this.nin)
{
if(%this.debug){echo(%Line);}
%this.colent = false;
%this.nin = false;
%Line = getSubStr(%Line, 52, strLen(%Line));
%this.curName = getSubStr(%Line, 0, strLen(%Line) - 5);
%this.File.writeLine(%this.curID TAB %this.curName);
%this.curID = "";
%this.curName = "";
}
if(strPos(%Line, "</html>") > -1)
{
%this.File.close();
%this.File.delete();
%this.File = "";
}
}

function Collector::CollectPage(%this, %Page, %Filepath)
{
%Page = mAbs(mFloor(%Page)) - 1;
%start = %Page < 1 ? "0" : %Page @ "00";
echo(%Page SPC %start);
%File = new FileObject();
%File.openForAppend(%Filepath);
%tcp = new TCPObject(Collector);
%tcp.file = %File;
%tcp.debug = true;
%tcp.urlreq = "/list.php?sort=0&dir=0&start=" @ %start;
%tcp.Connect("forum.returntoblockland.com:80");
}


I literally just found it buried in my old HDD, so I don't know if it still works or not.

that was really helpful, thanks