08.11.2011, 11:22
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ScktComp, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Memo2: TMemo;
ClientSocket1: TClientSocket;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
function SendText(URL: String): String;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Text:=SendText('www.delphisources.ru');
Memo2.Text:=SendText('ya.ru');
end;
function TForm1.SendText(URL: String): String;
begin
ClientSocket1.ClientType:=ctBlocking;
ClientSocket1.Host:=URL;
ClientSocket1.Port:=80;
ClientSocket1.Open;
ClientSocket1.Socket.SendText('GET / HTTP/1.1'#13#10#13#10);
Sleep(1000);
Result:=ClientSocket1.Socket.ReceiveText;
ClientSocket1.Socket.Close;
ClientSocket1.Close;
end;
end.
__________________
Пишу программы за еду.
__________________
|