Link to home
Start Free TrialLog in
Avatar of brainware
brainware

asked on

Retrive info from HTML

Hi

I desperate need a solution to retrive the value/string from a table on a certin website,
does not need to be fast parsing the html-code.

Example Pages:
http://www.edbpriser.dk/hardware/hardware-top10.asp?ID=1244578020
http://www.edbpriser.dk/hardware/hardware-top10.asp?ID=1364577995

What i need to retrive is the first number below TOTAL  eg 3.122 kr

bet some of you string parsing master have a solution ;)

Thanks
 Michael
Avatar of pjenglund
pjenglund

Hi,

I recoment you pay a visit to about.delphi.com and search for something called HTML File Scraping. They have a ready built example of how to retrieve certain elements from a HTML-file.

Just try to find distinctive patterns between which you can extract the data you want. Fo example, you can ditch everything from the beginnig to this point:
href="hardware-top10.asp?ID=1244578020&Sort=Total">

First, work in notepad to find the patterns and then try to implement it by the examle from about.com

It's certainly not the best way to do this but it's one way...

Hope this helped you a bit on the way!
do the htmlsource in Memo1 then you will get it in Edit1

procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=0 to Memo1.Lines.Count do
begin
if Pos('bedominfo.asp',Memo1.Lines.Strings[i])<>0 then
begin
Edit1.Text := copy(Memo1.Lines.Strings[i+9],Pos('>',Memo1.Lines.Strings[i+9])+1,Pos('</',Memo1.Lines.Strings[i+9])-2-Pos('>',Memo1.Lines.Strings[i+9]));
break;
end;
end;
end;
ASKER CERTIFIED SOLUTION
Avatar of mocarts
mocarts

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brainware

ASKER

Thanks all, Im looking at all of your examples,
very nice scanning methods,
can even use this for some other things too, very nice.

Thanks a lot