SRL Archive - Senior News and General

Php


Boreas

2008-12-01 09:05:04

http://www.runecrypt.com/graph/319

From what I can tell here
http://www.runecrypt.com/scripts/classes/openChart/actionscript/open-flash-chart.swf?data=http%3A%2F%2Fwww.runecrypt.com%2Fscripts%2Fprice_graph.php%3Fitem%3D319%26sexy%3D0
and here

They are using the php page to supply the data for the flash graph. That's the limit of my knowledge. Can somebody tell me how to use the php page in scar?

Markus

2008-12-01 10:43:00

http://www.runecrypt.com/scripts/price_graph.php?item=319
Data seems easy to parse, x_labels are timestamps (use UnixToDateTime in SCAR to decode), y values are the price ofcourse.

mastaraymond

2008-12-01 15:39:58

Why parse this?

Boreas

2008-12-01 23:14:58

Thanks Markus. Do you think there's a page with all the item names and IDs are together (like RHQ)? If not, I'll have to use this http://www.runecrypt.com/graph/itemlist.php?item=steel to make one.

Why not parse this? :p
Some SRL member and juniors have taken an interest in parsing the current price of an item. Which will eventually lead to something like the project in the senior section. On a public scale, the resulting traffic might help the eye of sauron. I figure this way is safer. Plus they have more than 30 days of data.

Smartzkid

2008-12-02 21:52:52

My most updated parser (afaik it's uploaded) makes a numname.db, which contains all item names & their id's

I like this, good find :)

Boreas

2008-12-03 00:26:35

Ah thanks. The answer was sitting on my drive the whole time haha. I just assumed since RHQ uses different numbers to RS, that RC would also be different. Sometimes I forget to follow the path of least resistance first :duh:

program New;
function strToIntArrayEx(intArray, Separater : String) : Array of Integer;
var
i, spacePos: Integer;
begin
repeat
SetArrayLength(Result, i + 1);
spacePos := Pos(Separater, intArray);
if (not (spacePos = 0)) then
Result[i] := StrToInt(Copy(intArray, 1, spacePos - 1))
else
begin
Result[i] := StrToInt(Copy(intArray, 1, Length(intArray)));
break;
end;
Delete(intArray, 1, spacePos);
i := i + 1;
until (False)
end;

var xlabels, values,pagestr:string;
intarr, intarr2: TIntegerArray;
i,t,itemnum:integer;
begin
itemnum:=2581;
pagestr:=getpage('http://www.runecrypt.com/scripts/price_graph.php?item='+inttostr(itemnum));
values:=between('&items='+inttostr(itemnum)+'&','&x_labels=',pagestr);
xlabels:=between(values,'&y_min=',pagestr);
Delete(values,length(values)-2,3);
Delete(values,1,10);
Delete(xlabels,length(xlabels)-2,3);
Delete(xlabels,1,10);
intarr:=strToIntArrayEx(xlabels,',');
intarr2:=strToIntArrayEx(values,',');
for i:=0 to getarraylength(intarr)-1 do
begin
writeln( DateToStr( UnixToDateTime(intarr[i]))+' '+inttostr(intarr2[i]));
end;
end.