
14.01.2011, 13:43
|
Новичок
|
|
Регистрация: 25.04.2010
Сообщения: 99
Репутация: 9
|
|
Ничего не спарсилось вообще.
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,strutils, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
IdHTTP1: TIdHTTP;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
sBeg = '<td align="right"><span class="arial">Country code:</span></td';
sEnd = '</td>';
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
iStart, iEnd : Integer;
sSrc, sTgt : String;
begin
sSrc := idHTTP1.Get('http://geoiptool.com/?IP=95.52.112.168'); // êàê òû ïîëó÷àåøü ñòðàíè÷êó
iStart := Pos(sBeg,sSrc) + Length(sBeg);
iEnd := PosEx(sEnd,sSrc,iStart)-1;
sTgt := Copy(sSrc,iStart,iStart-iEnd);
memo1.lines.add(sTgt);
end;
end.
|