Здравствуйте уважаемые товарищи кодеры. Пишу програмку для добавление страниц сайта в соц закладки. Нарисовался вот такой код:
| Код | unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, IdCookieManager, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
type TForm1 = class(TForm) IdHTTP1: TIdHTTP; IdCookieManager1: TIdCookieManager; sadres: TEdit; snazv: TEdit; sopis: TEdit; stag: TEdit; Button1: TButton; slogin: TEdit; sparol: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); var zz:TStringList; Resp:TStringStream; r,i,f,s,tok:String; begin try IdHttp1.Request.Referer:='http://memori.ru/loginform/'; zz:=TStringList.Create; zz.Add('login='+slogin.Text); zz.Add('password='+sparol.Text); zz.Add('membermy=on'); idhttp1.Post('http://memori.ru/loginform/',zz); finally zz.Free; end;
r:=IdHTTP1.Get('http://memori.ru/linkadd/'); i:='<input type="hidden" name="token" value="'; if Pos(i, r)=0 then ShowMessage('Ошибка при получении значения.') else f:=copy(r,pos('value="',r)+7,length(r)); s:=copy(f,0,pos('"',f)-1); tok:=Trim(s);
try idhttp1.Request.Referer:='http://memori.ru/linkadd/'; zz:=TStringList.Create; Resp:= TStringStream.Create(''); zz.Add('book:='); zz.Add('urlRedirect='); zz.Add('url='+sadres.Text); zz.Add('title='+snazv.Text); zz.Add('description='+sopis.Text); zz.Add('hdescr='); zz.Add('tags='+stag.Text); zz.Add('mark=5'); zz.Add('unSeen=on'); zz.Add('ShowOnMain=on'); zz.Add('token='+tok); idhttp1.Post('http://memori.ru/linkadd/',zz,Resp); Memo1.Text:=Resp.DataString; finally begin zz.Free; Resp.Free; end;
end;
end;
end.
|
Но не работает... Судя по всему косячу с авторизацией, но вот где , найти не могу. Помогите пожалуйста советом, ткните носом  |