Показать сообщение отдельно
  #5  
Старый 08.07.2015, 14:42
Аватар для NumLock
NumLock NumLock вне форума
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, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses WinHTTPComponents;

{$R *.dfm}

function StringToHex(s: String): String;
var
  i: Integer;
  c: Char;
  r: String;
begin
  r:='';
  for i:=1 to Length(s) do
  begin
    c:=s[i];
    r:=r+'%'+IntToHex(Ord(c), 2);
  end;
  Result:=r;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  WinHttp: TWinHttp;
begin
  WinHttp:=TWinHttp.Create(Self);
  try
    Memo1.Text:=WinHttp.Get('https://geocode-maps.yandex.ru/1.x/?geocode='+StringToHex(AnsiToUtf8(Edit1.Text)));
    Memo1.Lines.SaveToFile('geocode-maps.yandex.ru.xml');      
  finally
    WinHttp.Free;
  end;
end;

end.

TWinHttp реализует WinHTTP API
__________________
Пишу программы за еду.
__________________
Ответить с цитированием