用idhttp组件做的小程序能登陆但不能提交文章(100)

  • 主题发起人 主题发起人 kaixin9628
  • 开始时间 开始时间
K

kaixin9628

Unregistered / Unconfirmed
GUEST, unregistred user!
以下是一个用idhttp组件做的登陆一个网站提交文章的程序,现在登陆能成功,但不能发表文章,请帮忙!截取程序与手工发布的POST和COOKIE信息相比较但看不出不同。unit qufa1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, IdCookieManager;type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; IdHTTP: TIdHTTP; IdCookieManager1: TIdCookieManager; procedure Button1Click(Sender: TObject); private { Private declarations } public end;var Form1: TForm1;implementation{$R *.dfm}function getstr(strzong:string;strkaishi:string;strjieshu:string):string;var beginpos,endpos:integer; substr:string;begin result:=''; endpos:=pos(strkaishi,strzong); substr:=copy(strzong,endpos+length(strkaishi),length(strzong)-endpos); beginpos:=pos(strjieshu,substr); result:=copy(substr,1,beginpos-1);end;procedure TForm1.Button1Click(Sender: TObject);const BaseURL = 'http://www.insanejournal.com'; //论坛所在地址 UserName = 'zhangsan67890'; //登录用户名 Password = '123456789'; //登录密码var Params: TStrings; HTML: String; MD5Pass: String; ret:tstringstream; SiYouBianLiang1:String; //每个网站临时用到的变量1 SiYouBianLiang2:String; //每个网站临时用到的变量2 SiYouBianLiang3:String; //每个网站临时用到的变量3begin Params:=TStringList.Create; ret:=TStringStream.Create(''); try IdHTTP.HandleRedirects := true;//首先取得HTML IdHTTP.request.contenttype:='application/x-www-form-urlencoded'; IdHTTP.Request.Referer := BaseURL; HTML:=IdHTTP.Get(BaseURL+'/login.bml'); Memo1.Lines.Text := HTML; Params.Clear; Params.Add('lj_form_auth='+getstr(HTML,'name="lj_form_auth" value="','"')); SiYouBianLiang1:= getstr(HTML,'name="lj_form_auth" value="','"'); SiYouBianLiang2:= getstr(HTML,'name=''chal'' class=''lj_login_chal'' value=''',''''); Params.Add('chal='+getstr(HTML,'name=''chal'' class=''lj_login_chal'' value=''','''')); Params.Add('response='+''); Params.add('user='+UserName); Params.Add('password='+Password); Params.Add('action:login=Login...'); IdHTTP.HandleRedirects := true; IdHTTP.request.contenttype:='application/x-www-form-urlencoded'; IdHTTP.Request.Referer := BaseURL; IdHTTP.Post(BaseURL+'/login.bml',Params,ret); HTML:=ret.datastring; //Memo1.Lines.Text := HTML; //下面开始提交文章 HTML:=IdHTTP.Get(BaseURL+'/update.bml'); Params.Clear; Params.Add('lj_form_auth='+SiYouBianLiang1); Params.Add('chal='+SiYouBianLiang2); Params.Add('response='+''); Params.Add('user='+''); Params.Add('password='+''); Params.Add('usejournal='+''); Params.Add('date_ymd_mm='+FormatDateTime('mm',now())); Params.Add('date_ymd_dd='+FormatDateTime('dd',now())); Params.Add('date_ymd_yyyy='+FormatDateTime('yyyy',now())); Params.Add('hour='+'17'); Params.Add('min='+FormatDateTime('nn',now())); Params.Add('date_diff='+'0'); Params.Add('subject='+'test1test1bbbbbbbbbbbbbbbbbbbbb');//标题 Params.Add('event='+'test11nnnnnnnnnnnnnnnnnnnnnnnnn'); //内容 Params.Add('switched_rte_on='+getstr(HTML,'input type=''hidden'' name="switched_rte_on" value="','"')); Params.Add('prop_taglist='+'test1'); //标签 Params.Add('prop_current_moodid='+''); Params.Add('prop_current_mood='+''); Params.Add('comment_settings='+''); Params.Add('prop_current_location='+''); Params.Add('prop_opt_screening='+''); Params.Add('prop_current_music='+''); Params.Add('security='+'public'); Params.Add('action:update='+'Post to zhangsan67890'); IdHTTP.request.contenttype:='application/x-www-form-urlencoded'; IdHTTP.Request.Referer := BaseURL+'/update.bml'; IdHTTP.Post(BaseURL+'/update.bml',Params,ret); finally Params.Free;end;end;end.
 
今天又做了一个关于wordpress的进行模拟提交,结果也是登陆成功,模拟提交失败。返回的界面上日期时间处于编辑状态等待修改。和上一个的程序一样,还是日期时间的问题!哪位遇到过这样的问题啊?
 
后退
顶部